Questions tagged [apache-poi]

Apache POI is a Java library for reading and writing various Microsoft file formats, especially Office related ones. It supports OLE2 and OOXML based formats, such as XLS, XLSX, DOC, DOCX, PPT and PPTX as well as a few others.

The mission statement of the Apache POI project 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). This includes Excel formats (.xls and .xlsx), Word (.doc and .docx), PowerPoint (.ppt and .pptx), as well as others to a lesser extent like Visio, Outlook and Publisher.

This tag should be used for questions around using and extending Apache POI. Questions on the .Net port should use the tag instead.

More information on Apache POI, the bug tracker and download links are available from https://poi.apache.org/

If you are starting with Apache POI, you may find the Busy Developer's link very useful : https://poi.apache.org/spreadsheet/quick-guide.html

Apache POI releases are available under the Apache License, Version 2.0.

9727 questions
14
votes
3 answers

Apache-POI sorting rows in excel

I'd like to sort rows in a sheet by one of string column. I tried to achive that using Sheet.shiftRows method, but I cannot manage with that. It doesn't switch positions of rows in my method. What's wrong in my code? Or maybe there is better way to…
robson
  • 1,623
  • 8
  • 28
  • 43
13
votes
4 answers

Create a password protected Excel file using Apache POI?

I am developing a simple Java program to create an Excel file using (Apache POI) API. I am using Oracle 10g as a database and using the ojdbc14 JAR file. I have a table called USERINFO, having three columns, namely USERNAME, PASSWORD, and NAME. Now…
vikiiii
  • 9,246
  • 9
  • 49
  • 68
13
votes
4 answers

How to read empty cells of an excel file using POI

I have tried to read an excel file using POI and then I wanted to put that data into a JTable. Here is the excel file, As you can see, there are two empty cells in the above table, once I read above data into a JTable I got following result, In my…
Harsha
  • 3,548
  • 20
  • 52
  • 75
13
votes
3 answers

Trying to port Apache POI to Android

I'm looking for a lightweight version of poi-3.8.jar to use it in an Android (private) app. I don't seem to be able to fit the whole 1.7Mb jar in the APK for some reason (and it would be wrong to do so anyway) and since I'm only looking for the doc…
Johann Hilbold
  • 201
  • 1
  • 2
  • 8
13
votes
5 answers

Java Apache POI newline characters are ignored when writing to XWPFTable cell

Hoping someone might have some experience with this. I'm using Apache POI 3.8b4 to output a table in Word 2007 format. When I do something similar to the following: XWPFTableRow row = table.getRow(0); String text =…
ratherOCD
  • 167
  • 1
  • 1
  • 7
13
votes
1 answer

Apache POI: change page format for Excel worksheet

Is there a way to change the page size and layout while creating the Excel document using Apache POI? The default one is A4-vertical, while I need A6-horizontal (landscape). I don't think that this question requires code sample, the Excel document…
Georgy
  • 133
  • 1
  • 1
  • 4
13
votes
2 answers

how to read all cell value using Apache POI?

I want to read all cell value from excel sheet using Apache POI and store it into one dimensional string array .Is is possible to read data from excel row by row and extract value from each cell? Please help me to solve this problem. Thanks
Sameek Mishra
  • 9,174
  • 31
  • 92
  • 118
13
votes
4 answers

org.apache.poi.POIXMLException Strict OOXML isn't currently supported, please see bug #57699

I'd like to parse an Excel file with java, so I'm using apache poi libraries, here you are the maven dependencies: org.apache.poi poi-ooxml
user1820620
  • 672
  • 2
  • 13
  • 27
13
votes
8 answers

How can I access password protected Excel workbook in Java using POI api

I want to read from and write to password protected Excel files. How can I do so using Apache POI API.
Umesh
  • 131
  • 1
  • 1
  • 5
13
votes
1 answer

Remove all borders on a specific excel worksheet using Apache POI

I am using Apache POI to generate an Excel file. I need to delete all of the borders in my worksheet. How can I accomplish this using Apache PIO 3.11 and Microsoft Excel 2007? Here is the code I have so far: package models; import…
nairouz mrabah
  • 1,177
  • 2
  • 13
  • 26
13
votes
2 answers

Format number with thousands separator in Excel using Apache POI

I want to format some number cells, with a comma as thousands separator. For example: 12 -> 12 1200 -> 1,200 12000 -> 12,000 12000000 -> 12,000,000 120000000 -> 120,000,000 I have the following code. What should I use as formatStr?…
Alkis Kalogeris
  • 17,044
  • 15
  • 59
  • 113
13
votes
5 answers

Refresh Pivot table using Apache POI

No/Minimal documentation regarding Apache POI for Pivot tables in the Apache site has got me to write this. I want to refresh a pivot table in a Work Book using Apache POI. Please let me know where I can get proper documentation and Examples…
pavi
  • 654
  • 1
  • 9
  • 29
13
votes
5 answers

Seperated text line in Apache POI XWPFRun object

I 'm trying to replace a template DOCX document with Apache POI by using the XWPFDocument class. I have tags in the doc and a JSON file to read the replacement data. My problem is that a text line seems separated in a certain way in DOCX when I…
zaferaltun
  • 141
  • 1
  • 6
13
votes
1 answer

HSSF POI : How to know if data in cell is of Type Date?

Currently i have my code as bean.setREPO_DATE(row.getCell(16).getDateCellValue()); it works fine if cell is formatted as date in excel. However it also converts some integer or long like 1234 or 5699 to date. I know the reason behind this too.…
Abhishek Singh
  • 10,243
  • 22
  • 74
  • 108
12
votes
2 answers

FileInputStream vs ClassPathResource vs getResourceAsStream and file integrity

I have a weird problem : in src/main/resources i have a "template.xlsx" file. If i do this : InputStream is = new ClassPathResource("template.xlsx").getInputStream(); Or this : InputStream is =…
Maxime ARNSTAMM
  • 5,274
  • 10
  • 53
  • 76