generate excel in java - java

I want to generate excel with enabling auto-filter option.For that I have create one template excel file by enabling auto-filter option but when I write something into that template excel file auto-filter option disabled again.
Is there any solution to create excel file by enabling auto-filter option.

Not sure if this is what you are looking for (and you don't really describe how you write the file today). "create excel file by enabling auto-filter option" doesn't really make sense to me.
There is the Apache POI that I have used for generating excel files and it works pretty well. Is that was you are using to write excel files today?

I'd have a look at Andy Khan's JExcel. I think it's the best library out there for working with Excel in Java.

Related

How to generate an excel file from a PowerQuery query via java?

I am generating a metaquery created with the PowerQuery syntax, and I would like to use some library to generate an excel file from there.
I have tried POI and Docx4j with no success. Any advice would be helpfull.
Thanks in advance.
I'm not aware of any Java libraries that can add Power Query queries to an Excel file. The structure inside of the Excel file is documented here, so you could implement yourself, or request a library developer to implement it.
You can use VBA to automate creating queries in Excel 2016 https://gallery.technet.microsoft.com/office/VBA-to-automate-Power-956a52d1
Maybe you could use java to send a message to some VBA running in the Excel workbook, or to generate some VBA script that runs when you open the workbook, and have the VBA actually create the query?
Edu says: store the query in the windows clipboard and then generate the query via VBA in excel with a macro.

How to read and append a .xlsm file in java

I want to read and append a .xlsm file in java. I dont have any idea on how to do it.
Do i need to download any jar file to work with it?
All the search result provides a solution which uses apache poi(I did not get what it is). I dont use any IDE. Using simple FileReader and other logic can't I work with this type of file?
Please give me a clear idea on what is a .xlsm file and how to work with it using java.
"XLSM is a Microsoft Excel macro-enabled spreadsheet that contains worksheets of cells arranged by rows and columns and embedded macros programmed in the Visual Basic for Applications language. XLSM files are like XLSX files, but with macros enabled. They can be opened with Excel 2007 or later, or by previous versions of Excel with Open XML component support."
You can read and write to the file using Apache poi.
Take a look at the following SO Posts
write to xlsm (Excel 2007) using apache poi
Read data from read only xlsm file using Java Apache POI
The Apache POI documentation is located at
https://poi.apache.org/

How to convert .xls file to .htm file using JXL api?

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.

Generating line-graphs in Java for .xls files

Are there any libraries out there that can be used to generate line-graphs and export them to a .xls file?
Check out Apache POI (http://poi.apache.org/). However you need to use a limited workaround for this to work.
"You can not [sic] currently create charts. You can however create a chart in Excel, modify the chart data values using HSSF and write a new spreadsheet out. This is possible because POI attempts to keep existing records intact as far as possible." (http://poi.apache.org/spreadsheet/limitations.html)
You could also look into using the JExcelAPI (http://sourceforge.net/projects/jexcelapi/), but I have no familiarity with its limitations.

Convert from Excel xlsx to xls in Java

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.

Categories