This question already has answers here:
Embed files into XSSF sheets in Excel, using Apache POI
(2 answers)
Embed files into Excel using Apache POI
(2 answers)
Closed 1 year ago.
I need to export data to an excel team from a table. In the table I have the file attachments (pdf and word document) for each row. I need to embed those files in the cells of the excel.
I am able to write excel with table data except the files. Please share how do I embed the files to excel in cells corresponding to each row using Apache POI and Java.
I am looking for any Java library which can convert Word doc into PowerPoint format.
I have looked into some libraries such as documents4j which converts many of the formats but not Word doc into PowerPoint.
Look at Apache Poi: https://poi.apache.org.
From their mission statement:
The Apache POI Project's mission is to create and maintain Java APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft's OLE 2 Compound Document format (OLE2). In short, you can read and write MS Excel files using Java. In addition, you can read and write MS Word and MS PowerPoint files using Java. Apache POI is your Java Excel solution (for Excel 97-2008). We have a complete API for porting other OOXML and OLE2 formats and welcome others to participate.
OLE2 files include most Microsoft Office files such as XLS, DOC, and PPT as well as MFC serialization API based file formats. The project provides APIs for the OLE2 Filesystem (POIFS) and OLE2 Document Properties (HPSF).
I have extensively used this library with Word and Excel and it is really working well.
Is it necessary to add Apache POI and similar libraries to read and write Excel Files in JAVA? Is there any predefined JAVA library for reading and writing Excel Sheets?
All of the methods that i've searched for seem to use itext libraries, but is there a way to just use apache poi libraries ?
I don't believe so. POI is strictly for Microsoft documents and PDF was created by Adobe. So the short and quick answer is no.
If you read the docs for Apache's POI project you'll read in the title "Apache POI - the Java API for Microsoft Documents".
Apache POI Project
POI is explicitly made for Microsoft Documents. Using itext is the easiest way to generate or create a PDF file within Java.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Which of the 2 APIs is simpler to read/write/edit excel sheets ?
Do these APIs not support CSV extensions ?
Using JXL for file.xls and file.xlsx, I get an exception like:
jxl.read.biff.BiffException: Unable to recognize OLE stream
at jxl.read.biff.CompoundFile.<init>(CompoundFile.java:116)
at jxl.read.biff.File.<init>(File.java:127)
at jxl.Workbook.getWorkbook(Workbook.java:268)
at core.ReadXLSheet.contentReading(ReadXLSheet.java:46)
at core.ReadXLSheet.init(ReadXLSheet.java:22)
at core.ReadXLSheet.main(ReadXLSheet.java:72)
Both for .xls and .xlsx extensions.
Java Version I am using is : JDK1.6
I have used both JXL (now "JExcel") and Apache POI. At first I used JXL, but now I use Apache POI.
First, here are the things where both APIs have the same end functionality:
Both are free
Cell styling: alignment, backgrounds (colors and patterns), borders
(types and colors), font support (font names, colors, size, bold,
italic, strikeout, underline)
Formulas
Hyperlinks
Merged cell regions
Size of rows and columns
Data formatting: Numbers and Dates
Text wrapping within cells
Freeze Panes
Header/Footer support
Read/Write existing and new spreadsheets
Both attempt to keep existing objects in spreadsheets they read in intact as far as possible.
However, there are many differences:
Perhaps the most significant difference is that Java JXL does not support the Excel 2007+ ".xlsx" format; it only supports the old BIFF (binary) ".xls" format. Apache POI supports both with a common design.
Additionally, the Java portion of the JXL API was last updated in 2009 (3 years, 4 months ago as I write this), although it looks like there is a C# API. Apache POI is actively maintained.
JXL doesn't support Conditional Formatting, Apache POI does, although this is not that significant, because you can conditionally format cells with your own code.
JXL doesn't support rich text formatting, i.e. different formatting within a text string; Apache POI does support it.
JXL only supports certain text rotations: horizontal/vertical, +/- 45 degrees, and stacked; Apache POI supports any integer number of degrees plus stacked.
JXL doesn't support drawing shapes; Apache POI does.
JXL supports most Page Setup settings such as Landscape/Portrait, Margins, Paper size, and Zoom. Apache POI supports all of that plus Repeating Rows and Columns.
JXL doesn't support Split Panes; Apache POI does.
JXL doesn't support Chart creation or manipulation; that support isn't there yet in Apache POI, but an API is slowly starting to form.
Apache POI has a more extensive set of documentation and examples available than JXL.
Additionally, POI contains not just the main "usermodel" API, but also an event-based API if all you want to do is read the spreadsheet content.
In conclusion, because of the better documentation, more features, active development, and Excel 2007+ format support, I use Apache POI.
I have used POI.
If you use that, keep on eye those cell formatters: create one and use it multiple times instead of creating each time for cell, it is a huge memory consumption difference on large data.
I am not familiar with JXL and but we use POI. POI is well maintained and can handle both the binary .xls format and the new xml based format that was introduced in Office 2007.
CSV files are not excel files, they are text based files, so these libraries don't read them. You will need to parse out a CSV file yourself. I am not aware of any CSV file libraries, but I haven't looked either.
For reading "plain" CSV files in Java, there is a library called OpenCSV, available here: http://opencsv.sourceforge.net/