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
15
votes
3 answers

How do I change the Text Color and the Fillcolor

How do I change the header font color to white and the fill green? These are the classes that I am using: import static org.apache.poi.ss.usermodel.CellStyle.* import static org.apache.poi.ss.usermodel.IndexedColors.* import…
Jonathan Morningstar
  • 421
  • 3
  • 11
  • 25
15
votes
3 answers

write a XSSFWorkbook to a zip file

I now have this problem. I want to write a excel file hold in this XSSFWorkbook (workbook) obj into a zip file eg(example.zip while contain this example.xlsx file) to a remote server. I have tried following but not working, it created a folder…
user1721910
  • 161
  • 1
  • 1
  • 4
15
votes
2 answers

How to extract plain text from a DOCX file using the new OOXML support in Apache POI 3.5?

On September 28, 2009 the Apache POI project released version 3.5 which officially supports the OOXML formats introduced in Office 2007, like DOCX and XLSX. Please provide a code sample for extracting a DOCX file's content in plain text, ignoring…
Robert Campbell
  • 6,848
  • 12
  • 63
  • 93
15
votes
8 answers

Reading string value from Excel with HSSF but it's double

I'm using HSSF-POI for reading excel data. The problem is I have values in a cell that look like a number but really are strings. If I look at the format cell in Excel, it says the type is "text". Still the HSSF Cell thinks it's numeric. How can I…
egaga
  • 21,042
  • 10
  • 46
  • 60
15
votes
6 answers

Apache POI xls column Remove

I don't find how to remove a column with the Apache POI API. I would appreciate a sample code or help on this point.
VGS
14
votes
8 answers

How to convert HSSFWorkbook to XSSFWorkbook using Apache POI?

How to convert org.apache.poi.hssf.usermodel.HSSFWorkbook to org.apache.poi.xssf.usermodel.XSSFWorkbook in Apache POI? Environment : JSE1.6 JBossAS 4.3.2 POI 3.7
Bhuvanesh Phadnis
  • 363
  • 1
  • 3
  • 9
14
votes
4 answers

Importing CSV data with Apache POI

How can I efficiently import CSV data with Apache POI? If I have a very large CSV file that I would like to store in my Excel spreadsheet, then I don't imagine that going cell-by-cell is the best way to import...?
Jake
  • 15,007
  • 22
  • 70
  • 86
14
votes
4 answers

Apache POI for Excel: Setting the cell type to "text" for an entire column

I need to generate an .xls (Excel) file, using the Java library Apache POI for spreadsheets. The file will contain a list of phone numbers in column A, formatted as "0221...." or "+49221..." - so Excel by default interprets them as numeric cells.…
Chris Lercher
  • 37,264
  • 20
  • 99
  • 131
14
votes
5 answers

Apache POI Java Excel Performance for Large Spreadsheets

I have a spreadsheet I'm trying to read with POI (I have both xls and xlsx formats), but in this case, the problem is with the xls file. My spreadsheet has about 10,000 rows and 75 columns, and reading it in can take several minutes (though Excel…
Jeff Storey
  • 56,312
  • 72
  • 233
  • 406
14
votes
1 answer

React excel file download corrupt

Im trying to download an Excel file in Reactjs by calling a Spring REST endpoint but I'm running into issues with a corrupt file. React call... getFile(){ axios.get('get/download') .then((response) => { var blob = new…
rogger2016
  • 821
  • 3
  • 11
  • 28
14
votes
2 answers

Obtain the "absolute path to the workbook" from an .xls file

When I use the Excel "Document Inspector" on a particular .xls file to check for "hidden properties or personal information" it says: The following document information was found: * Absolute path to the workbook How can I obtain the absolute…
WW.
  • 23,793
  • 13
  • 94
  • 121
14
votes
5 answers

java.lang.ClassNotFoundException: org.apache.poi.xssf.usermodel.XSSFWorkbook

when i tried to create a workbook in normal java class it is creating but when i tried to run the same on servlet it is throwing exceptions Normal java class import java.io.File; import java.io.FileInputStream; import…
Rajasekhar
  • 787
  • 6
  • 13
  • 31
14
votes
4 answers

How to create .docx files and .xlsx files on Android

I have a very simple question: How to create .docx and .xlsx files on Android. Before someone marks this as duplicate, let me tell you that I have extensively tried creating them using Apache POI and my attempts are described in these…
SoulRayder
  • 5,072
  • 6
  • 47
  • 93
14
votes
3 answers

apache poi excel big auto column width

I am try to create a big excel 2010 with 30 columns and 1 million records with Apache poi latest. I am creating as describe in this link…
Ram Sharan Mittal
  • 526
  • 2
  • 7
  • 16
14
votes
2 answers

Read xlsx file with POI (SXSSFWorkbook)

I'm trying to do my first tests of reading large xlsx file with POI, but to do a simple test with a small file I fail to show the value of a cell. Someone can tell me what is my mistake. All the suggestions are welcome. Thanks. Test.java: import…
alditis
  • 4,633
  • 3
  • 49
  • 76