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
9
votes
1 answer

How to "format as table" in Excel or apache POI?

In Excel 2010 it's possible to "format as table" a group of cells - enabling easy sorting and filtering (Home > Format As Table). Can I do the same in Apache POI? Alternatively, can one accomplish the above directly in Excel via a macro/formula (as…
Nikita
  • 6,019
  • 8
  • 45
  • 54
9
votes
2 answers

An illegal reflective access operation has occurred Apache POI

I'm using Apache POI to work with excel files, as of Java 9 I get this message, according to this post JDK9: An illegal reflective access operation has occurred. org.python.core.PySystemState we should wait for the developer to fix the issue, but…
tobiasbriones
  • 221
  • 1
  • 2
  • 9
9
votes
0 answers

How to convert a MS Word doc containing UTF-8 characters to PDF with Apache POI?

For some reason I cannot get the PdfConverter from Apache POI to convert my MS Word document properly on a Linux machine. On Windows and MacOS it seems to work fine but whenever I try it on a Linux machine it basically doesn't convert the UTF-8…
Tranquilized
  • 721
  • 2
  • 6
  • 23
9
votes
5 answers

Read Huge Excel file(500K rows) in java

I am trying to read a Big XLSX File. The Excel file has around 500K rows.I need to read col 2. OPCPackage pkg; pkg = OPCPackage.open("File path"); XSSFWorkbook myWorkBook = new XSSFWorkbook(pkg); Sheet sheet = myWorkBook.getSheetAt(2); Iterator
Rajib_Podder
  • 91
  • 1
  • 1
  • 2
9
votes
2 answers

How to decrease default height of a table row in word using apache poi in java

I am using Apache Poi for creating word, I cant able to decrease row height. I found two methods for setting height but both are not working. i used the following snippets. int nRows2 = 6; int nCols2 = 3; XWPFTable table2 = doc.createTable(nRows2,…
vijaya kumar
  • 824
  • 2
  • 12
  • 21
9
votes
3 answers

Java POI XSSF VLookup formula

I am trying to put simple VLookup formula in my ".xlsx" file using Java and Apache POI. This formula is having the external reference and that is NOT working for me. So to give you more details I am using poi and poi-ooxml version 3.13 and excel…
ManishChristian
  • 3,759
  • 3
  • 22
  • 50
9
votes
3 answers

Is there any way to create a Pivot Table in Excel using Apache POI?

I am currently working on the automation of Excel, and add such I have made a good use of the Apache POI library. As I have so much data stored in my excel workbook in various columns, that I'm trying to create a pivot table. Is there any way to…
SabareeshSS
  • 1,361
  • 2
  • 11
  • 20
9
votes
2 answers

What to use instead of deprecated CellRangeAddress.valueOf in ApachePOI

I wanted to add conditional formatting in the region but One method which I saw in tutorial is deprecated. What to use instead of it. Sample: ConditionalFormattingRule rule2 = sheetCF.createConditionalFormattingRule(ComparisonOperator.LT, "50"); …
Yoda
  • 17,363
  • 67
  • 204
  • 344
9
votes
5 answers

Number stored as text warning in excel using POI

I am getting Number stored as text warning for the created excel file using POI. I am trying to display percentage. This question discusses the same, but it's for python. Can some one please suggest me how to avoid this in java using POI? Below are…
rick
  • 4,665
  • 10
  • 27
  • 44
9
votes
2 answers

Apache POI add a Series name into LineChart

I am creating a LineChart using Apache POI in Excel document. As far as I've managed to achieve is in the below image: I wrote the code using examples from Apache's svn, so my current approach looks like this: Drawing drawing =…
Paulius Matulionis
  • 23,085
  • 22
  • 103
  • 143
9
votes
4 answers

Syntax error on token(s), misplaced construct(s)

How to fix this error ---> Syntax error on token(s), misplaced construct(s) The error is at the line below indicated. Note: This code was copied on the web and trying to get it to work as a learning tool I'm using Eclipse Thanks! import…
user3277243
  • 129
  • 1
  • 1
  • 5
9
votes
1 answer

Apache POI autoSizeColumn resizes to minimum width

When working with values that are formulas, I am having difficulty getting the columns to autoresize properly. I have "solved" this by making a hidden row that has maximum values as constant strings values, but that is far from elegant and often…
user289086
9
votes
3 answers

Using custom colors with SXSSF (Apache POI)

I am trying to write a huge excel file, my requirement allows me to write the row and forget, so i am using SXSSF which allows to keep only a few number of rows in memory and rest all are written to the document. this helps in overcoming outofmemory…
gaurav5430
  • 12,934
  • 6
  • 54
  • 111
9
votes
8 answers

Word document creation API in Java

I would like to create a word document using a template, replace some variables (fields) and save it as a new word document. I was thinking using Apache POI, http://poi.apache.org/ is it the best for this purpose? can you share your impression from…
Eran Medan
  • 44,555
  • 61
  • 184
  • 276
9
votes
12 answers

what give java.lang.NoClassDefFoundError?

I want to read excel file but give Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject at ExcelReader.main(ExcelReader.java:32) Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlObject at…
sharafi
  • 531
  • 1
  • 7
  • 19