I am using Apache POI 3.17 and I have an Excel file which needs calculation. Lets assume that the whole excel file needs calculating!
When I save this file as XLS and then use the POI API's then the EvaluateAllFormulaCells is done in 1.5 seconds!
However the same file as XLSX, the EvaluateAllFormulaCells take 8.5 Seconds, sometimes even more.
For your information I have rounded out the possibility of corrupt file while changing the file types!
Any idea on this would be greatly appreciated.
Thanks
Related
Are there any libraries that work with Codename One that would allow me to read/write to an excel file for the app I'm building? I've tried Apache POI, but I haven't gotten it to work with Codename One. I assume this because CN1 only supports certain libraries. If Apache POI does work with CN1, please tell me.
Codename One has a CSV parser that allows you to read CSV files exported by typical spreadsheets but not the rather complex Excel file format. You can probably port POI to Codename One but that might require some effort.
I'm trying to convert a .xls file to .pdf using LibreOffice via command line on Ubuntu. I have a kind of report on the .xls file with some colors in the background of the cells and etc.
The problem is when I convert the .xls file, the .pdf loses the original format. Each page is broken almost in the half and the content of one page is displayed in two different pages.
Does anybody know how to convert the .xls file to .pdf via command line with keeping the original format?
Or some trick to set the size of the .pdf page to not break pages? (Also via command line)
The code I used to make the conversion was:
soffice --headless --convert-to pdf:"impress_pdf_Export" filename.xls
If you use LibreOffice to convert Microsoft Excel (XLS) files to PDF documents, this is a two-step process (even if your command does look like it is a one-step process):
Import the XLS into LibreOffice (even if started with --headless).
Export the PDF from LibreOffice.
If the result does not look like you expect (not similar enough to Excel's native PDF export), then start with debugging the first step from above:
Open the XLS file with LibreOffice in a GUI. Does it look like you expect it to look? Or are some formatting options looking weird?
Export the PDF from there (with the GUI). Are the page dimensions as you expect? Did you set them up how you prefer? The margins like you want them? etc.pp. ...
If you are working on Windows, you may also want to consider OfficeToPDF.exe. It is hosted on CodePlex, licensed with the Apache 2.0 License and available in binary and in source code.
It requires a working Office 2013, Office 2010 or Office 2007 installation. But then it can commandline- and batch-convert to PDF various MS Office-based file formats, including XLS(X), PPT(X), DOC(X), VSD(X) and PUB as well as Libre/OpenOffice-based ODT, ODS and ODC files.
Although this is a little bit off from the initial question (you don't _really need Office Libre if you have the Office suite and on a Windows machine)
I do appreciate the follow-up provided by Kurt. It prompted me to post the following Gist offering some clear instructions on how to go about using the .exe in a for loop.
https://gist.github.com/einsty/2189cae4175f619cff0f
Try copying appropriate font file (for me it's
a simsun.ttc file) to your libreoffice installing directory like '/opt/libreoffice4.2/share/fonts/truetype'.But if the width of a single excel sheet is too much for a print page(sth like 'A4'),it'll still collapse.
I tried to create an xls file in labview 2010 as shown below:
I get something like below in this excel file:
0.13 0.01 99
0.51 0.02 99
13.97 0.55 8.81
23.11 0.91 12.04
36.7 1.45 8.74
50.42 1.99 8.67
However, when I open excel I get the warning that:
"the file you are trying to open xls is in a different format than
specified by the extension"
when I change the file to a .csv, I no longer get this error. But I need excel to open it in the xls format without the warning. Can this be done?
LabVIEW cannot directly write to an XLS format file.
You can write a CSV and open it in Excel (Excel will open a CSV file with a .xls extension, as you are seeing).
On Windows you can use the Report Generation Toolkit or one of the Excel automation interfaces (.NET/ActiveX) to tell Excel to write an XLS file with the values that you specify programatically. This requires that Excel be installed on the local machine.
In LabVIEW 2013 you can use the "Write to Measurement File Express VI" to write directly to XLS*X* files without having Excel installed.
There may be a non-NI support library or command line tool you could call but I'm not aware of one.
This document explains a little more:
http://www.ni.com/newsletter/51339/en/
If you need to write to .xls (not .xslx) format directly from LabVIEW there is a third party toolkit available from NI, but it costs extra.
Alternatively if you can use Python (for example) you could write a short Python script to convert a csv file to xls using the xlwt package, and call this from LabVIEW using System Exec. I expect there are similar packages available in other scripting languages.
I am running a Linux server and one of our suppliers only knows how to send me an Excel file which I need to import into our system daily. Does anyone know of a good way to export the Excel file to a delimited file? Preferably with php or perl.
Thanks!
Chris Edwards
Java library POI does this quite well, with very simple API.
http://poi.apache.org/
OpenOffice (or LibreOffice) has a scripting ability, alas, which I have never looked at. However, it seems it would be straightforward to open the Excel file using Calc, and then do a Save As .csv operation.
Is there any type of automation available where I can use OpenOffice Calc to open Excel files and convert them to CSV or tab-delimited files?
I'm currently using PHPExcel to open the files and iterate through them and import each row into a database but have begun to run into memory issues with large files and need another alternative.
These are xls and xlsx files so it has to work for all of them.
If there is, how would I go about programming this in PHP?
If you have other alternatives, please feel free to suggest them.
OpenOffice can be run in server mode and used to convert files between a number of supported formats.
I have used this mainly with Java thru the JODConverter library available at http://www.artofsolving.com/opensource/jodconverter
A quick websearch brought up http://sourceforge.net/projects/phopo-org/ which claims to be a PHP implementation