Convert excel file to PDF using Java API - excel

I have an Excel file that has multiple graphic content (a normal excel file).
I am reading this file using POI API in java. I am able to convert the file to PDF table using iText jar.
But, the whole format is not copied into the PDF. (e.g., merged cells come into one column, and other formatting or settings are all gone).
A simple pdf table is created like below.
However when I convert with MS Excel and save as PDF i get the below output which has all the formatting details and looks perfect.
How do i retain the same format as in excel? I have done some googling on this and got some methods like OpenOffice API but all of them convert files on local machine. What if I send my tomcat build to client machine where OpenOffice is not installed ? Need some solution for that. Any help would be useful.

Related

Column width style lose when converting .xls to csv

I am exporting an .xlsx document to .csv but I during that conversion I am loosing the complete style. Column width style is loosing terribly I was using Mac OS Numbers app but If i remember it correctly same issue happened with Microsoft excel ( I do not have the windows machine to cross check that for the moment).
original excel image
Exported csv image
I was wondering whether this is an application related issue or is it something wrong in general.
Did anyone face the same issue ? I do not have idea about where to begin to solve the styling issue. Some pointer will be greatly appreciated.
I added apache poi tag because I created the original excel using apache-poi
CSV stands for "Comma Separated Value".
CSV is a text file. Basically, you can open it with Excel or with a basic text editor. It is not made for storing formatting.
If you need to deal with formatted table then you have to choose another format.

Import pdf into specific worksheet

There are lots of topics about this item, but I wasn't able to find an answer to my question. I want to select a pdf file and import all the text from this file into a specific sheet, let's call it sheet2. Please note this is a new pdf file every day, so it cannot come from a specific location, but the file has to be selected every day.
Any ideas?
If you can waver the limitation of using only VBA, you could use iText (combined with Apache POI). iText is more than capable of extracting the text from a pdf file, and the apache POI library allows you to generate Office documents (such as excel workbooks).

Is it possible to export view to Excel in specify format without using Apache POI?

I read this article. The program (from website) allows the user to generate a customized Word document use Apache POI. I found the code from these two websites that can generate Excel file use agent, however the output is generate the view in Excel format only.
Is it possible to export view to Excel in specify format without use Apache POI?
Instead of using Apache POI, is it possible to write code in agent to generate a customized Excel file?
No and Yes. You deal with Java on XPages. You could reinvent the wheel and write all was POI does yourself, so yes you could.
You also could output a HTML table but send a header of application\vnd-excel to get the table automatically opened in Excel (but no formula here)
What would stop you from using POI?

Reading custom data format into Excel VBA

I have a file of extension *.qub that I would like to read into Excel. The file contains spacecraft instrument data. The file has two parts, a SFDU-defined text header followed by binary data.
Ideally, we would like the user to be able to access the files using Excel's built-in File-->Open and File-->Save functionality to import/export this *.qub format.
What is the best way to create a custom file reader/writer in Excel?
Thank you!

save a cfdocument as an excel file

is there a workaround to use the cfdocument tag to save a page/file as an excel sheet instead of a PDF file?
I already have a process set up to make pdf files and email them out and would like to give my customers the option of getting an excel file instead. It would be nice if I could reuse the code I already have instead of having to rewrite it in POI or something like that.
The type of data witihn a PDF is not usually the same type of data that makes sense for Excel. That being said, there are multiple other ways to create Excel spreadhseets.
In ColdFusion 9, it's native. Just use the cfspreadsheet. In CF8... well, it looks like you have POI. So use that. ;) Ben Nadel also has a nice wrapper for POI so you can consider that too.
The thing is - you will not be able to go from CFDOCUMENT to a spreadsheet since it is really a different type of data.
In ColdFusion 9 use the cfspreadsheet tag and/or spreadsheet functions. That creates a real Excel file.
In ColdFusion 8 and below the easiest way is to use the html table > Excel hack/trick. Put your data in a standard html table, save them in a file with a .xls extension and email them to your users. When the user opens the file Excel will convert the html table to an Excel spreadsheet. You could also send the content to the browser by adding at the top of the page. With this method make sure that you are only sending an html table for best results.

Resources