As far as I am aware, there is no simple, built-in mechanism that will allow you to use POI to convert between the OpenXML file format to the binary one. Having said that most of the support does exist to allow you to write such a utility but there are going to be areas that POI does not yet support. For example, I cannot think of a way to copy macros between the two versions, I think that XSSF does not yet support data validations and I am not sure how you would copy charts between workbooks. Having said that, tranforming simple files should be possible by simply working through the file sheet by sheet row by row, cell by cell.
If I were tackling such a problem, I would look firstly to using Excel itself either by writing and running macros within a workbook - simply wirte a macro that can open a workbook and then resave it into the new format - or by using a library such as JACOB or the OLE32 package of the Standard Widget Toolkit to leverage Excels' OLE/COM interface. Remember that even if you do not have access to Office 2007, it is possible to patch earlier versions using Microsoft's Compatibility Pack; then you can open OenXML files with, for example, Excel 2000. Alternatively, OpenOffice has filters that can open OpenXML files and it can save them into the binary format - though not resave them as OpenXML files yet as far as I am aware. Further, OpenOffice does expose an interface (UNO) and you can use Java code - amoungst other languages - to develop programs that use this interface. Both approaches do have problems and I would not advise using either in a busy commercial environment, but for the more technically confident either could be quite a successful solution to processing smaller numbers of files on an ad-hoc basis. Somewhere, I have the code for both OLE/COM and UNO and will be happy to look it out for you if you want to use either approach. Finally, there are free web based tools such as Zamzar that will convert files for you - though this will mean uploading your files to the internet and possibly exposing their contents to a wide audience - and I am confident that a google search will expose other possibilities; I know for example that there is a .NET based solution that is available to C# developers but simply cannot recall it's name now. Many if not all of these will be commercial offerings however. Yours Mark B Max Zhao wrote: > > I am trying to convert a MS XML Spreadsheet to MS EXCEL(native) with POI > 3.2. Is it possible? How can I make it? Any samples? > -- View this message in context: http://old.nabble.com/How-to-convert-XMLSS-to-MX-EXCEL-tp26952438p26964886.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
