I have a Microsoft Excel file and I need to convert it to HTML. In excel, it is pretty simple to do: there is the "Save As..." option and you select "web page (.htm)". But I need to do this from Java, using JXL. Does anyone know how to achieve this?
Take a look at either the XML or CSV classes: they are examples of how to extract data from an Excel document and do something interesting with it.
You may also want to take a look at the Apache POI project if JXL doesn't look like it's going to meet your needs.
Related
Does anyone know if I can use something like Apache POI to convert an Excel file into CSV file in Java without application to parse into it?
Well, there needs to be some application, but you don't have to write it yourself.
I think there is no such ready-made tool included in POI itself, but other people have made such things and you can probably (disclaimer: I have not tried any) use them, for example
https://github.com/anjlab/excel2csv-java
http://code.google.com/p/excel2csv/
Note that this is bound to work only for very simple Excel files, as the Excel workbook format supports a lot of stuff that cannot be expressed in CSV.
I need to create cell comments for existing excel file by extracting the xlsx file and using raw XML file.
Is it possible to do it in java without using Apache poi library?
Well I don't know much about excel but I found this website that might help you.
I need to create spreadsheet in various file format: .xls, .xlsx, .ods, csv. I want to know how can I achieve this in Java and about available open source API.
I found some API for .xls, .xlsx but not .ods. Any information will be very helpful.
Thanks and Regards.
Have you tried the OdfToolkit? I haven't used it but it sounds like something you need.
For pdf generation you can use apache fop and altova stylevision to generate xsl-fo files. For xls - there is apache poi and jxls for templating.
For .ods I am using Simple ODF.
Update
Simple ODF is moved to Apache. New link is here.
I need code in java for Excel to XML conversion.
where Excel sheet will be used as the input file and XML file as the output file.we have to read the Excel file Row and column wise and than write that data to XMl file.
please anybody give any Code or URL or any Repository of example,which would be appreciated.
Thanks,
Mishal Shah
Have a look at Apache POI. I'm sure there are some examples there.
This may not be the answer you were looking for, but Excel already has built-in support for XML. If you are using Excel 2007, you will need to enable the Developer tab on the ribbon. From there you can import and export XML schemas and files.
To enable the developer tab:
Click the Microsoft button...
Click Excel Options
Check "Show Developer Tab in the Ribbon"
You will need to create a map by either importing an example XML file that is in the same format as the one you'd like to export, or you can click Source and use a schema (XSD) file.
From there, you just need to map the elements in your XML Map to the data in your sheet, then export the data to an XML file.
I did a "Read Excel into a DefaultTableModel" in about 20 lines with the JExcel API. It was very nice and simple to use.
JExcel is another option, although I think it has less features and doesn't support the latest excel format like the Apache POI does.
I have done conversion of Excel(xlsx) to xml in Java recently. I assumed each row in excel as a single object here. Here are the steps I followed:-
Read Excel file using Apache POI
Created a xsd file and generated corresponding classes
Read each row created, created corresponding objects and initilaized values using the generated getter/setter methods in the classes
Added the objects to an arraylist which holds only objects the same type
Using Jaxb Marshelled the arraylist object to an output file
Ready to provide code if required Here's where you can start https://sites.google.com/site/arjunwebworld/Home/programming/jaxb-example
I have an Excel 2007 xlsx file that I would like to programmatically convert to an .xls file. The xlsx file is an export from a reporting tool, and I would like to convert it to xls for better compatibility with the software stack of my application users. The xlsx is as plain as it gets. Just rows with data and basic type information (int/date/string). No formulas.
My platform is Java, and I do not have Microsoft Office installed. I'm looking for a solution that will allow me to convert between the formats with the least amount of effort. I.e. I'd like to avoid having to write a custom "copy application" that would read the xlsx file and copy the rows and formatting to another file. Preferably, the solution is open source and/or free.
I have looked at POI, and as far as I could tell, it can read and write both xls and xlsx files. But I was not able to tell by browsing the documentation and examples if it could read one format and write out in the other. Before I dig in any deeper, I would like to check if any of you out there have done anything like this before in Java, and if you have any tips.
Converting with POI would be a tedious task. I would like to point you to JODConverter. JODConverter is used by OpenOffice to convert its stuff, so it should work fine for that task.
However, that being said, I have not used JODConverter myself.