Questions tagged [apache-poi-4]
108 questions
7
votes
1 answer
Apache POI 4.0: XSSFColor from java.awt.Color
org.apache.poi 4.0 removed the XSSFColor constructor that just uses java.awt.Color. In org.apache.poi 3.7 it was very easy to create the object by just writing
Color inputColor = Color.RED;
XSSFColor test = new XSSFColor(inputColor);
However, this…

ptstone
- 478
- 7
- 17
5
votes
1 answer
Apache POI - Retrieve text content between keywords in .doc file and conditionally render it
I would like to find text content between two keywords in .doc files, and conditionally render that text content or hide it. For example:
Lorem Ipsum is simply dummy text ${if condition} of the printing and
typesetting industry. Lorem Ipsum has…

NickAth
- 1,089
- 1
- 14
- 35
4
votes
2 answers
How to set a custom color to a XSSFCell using POI?
I would like to set a custom color to a CellStyle in POI, but it doesn't seem to be getting applied.
I have the following code:
XSSFColor color = new XSSFColor(new byte[]{ (byte) 60,
(byte) 120,
…

carlspring
- 31,231
- 29
- 115
- 197
3
votes
0 answers
What does java.lang.ArrayIndexOutOfBoundsException: Index -2 out of bounds for length 46410 mean when opening an XLS file using Apache POI?
I have a Microsoft Excel XLS file (2003 format) that when trying to open using Apache POI 3.17 (and 4.1.2) I get the below stack trace. I can open the Excel file without any errors in Excel 2016.
I do notice that when saving the file using Excel…

dukethrash
- 1,449
- 4
- 15
- 25
3
votes
0 answers
How can I set only the plot area height in XSSFChart using Apache POI 4.1.2
I have created a stacked bar chart using a template file. In my chart, there is one series and more than 100 legends. To show all legends I have adjusted the plot area Y-axis value, now the bar size bigger than expected. Are there any methods to…

jyothis
- 41
- 5
3
votes
1 answer
copy cells between Excel workbooks with Apache POI
I'm trying to copy from cells from one workbook to another with the latest version of Apache POI (4.1.2).
If both workbooks are .xlsx files, everything works fine. But if the source workbook is an (old) .xls file and the destination workbook is an…

Dónal
- 185,044
- 174
- 569
- 824
3
votes
1 answer
Streaming a POI SXSSFWorkbook to the servlet output stream
We are building a Spring boot REST endpoint that generates a large XLS file (may contain ~ 1mil lines) and provides it for download.
The current solution uses the SXSSF API of Apache POI library for creating the workbook;
after that we write the…

chirina
- 133
- 2
- 8
3
votes
2 answers
APACHE POI 4.1 : Set cell background color from hex code
I've tried different solutions posted on stack overflow to apply a background color to an Apache POI generated cell, but nothing worked.
I'm doing something like:
Workbook workbook = new XSSFWorkbook();
Sheet sheet =…

Tobet
- 327
- 3
- 7
- 17
3
votes
2 answers
Apache POI - java.lang.NoClassDefFoundError: org/apache/commons/compress/utils/InputStreamStatistics
I'm trying to read a word document (.docx) using Apache POI and it gives me this error...
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/commons/compress/utils/InputStreamStatistics
at…

Chamithra Thenuwara
- 399
- 6
- 19
3
votes
2 answers
Why am I getting IllegalArgumentException while using copyRowFrom(...) in XSSFRow?
I'm trying to use copyRowFrom(...); to copy the first row of a spreadsheet to the first row of a new XSSFSheet but something is not working right.
You can find the XSSFRow class and the method…

Ariel
- 1,222
- 2
- 14
- 25
3
votes
1 answer
apache-poi 4.0 NullPointer for series setTitle
Exception in thread "main" java.lang.NullPointerException at org.apache.poi.xddf.usermodel.chart.XDDFChartData$Series.setTitle(XDDFChartData.java:122)
The code follows as below:
CellReference cellref = new CellReference("A6");
//A6 value = "My…

Choo Chen Wei
- 33
- 4
2
votes
1 answer
Accelerate Apache POI SUMIF
In an xlsx workbook there are some cells with some unbounded SUMIF formulas like this: SUMIF(MySheetname!$B:$B,$E4,MySheetname!$I:$I).
The evaluation of one SUMIF function with Apache POI 5.0.0 lasts 100ms and the evaluation of the given workbook…
user14972917
2
votes
0 answers
Upgrade from 3.1.0 to 4.0.0 throws NoSuchMethod for org.apache.xmlbeans.XmlOptions.put(Ljava/lang/Object;)
Upgraded XMLBeans from 3.1.0 to 4.0.0 and it throws a NoSuchMethodError exception for
org.apache.xmlbeans.XmlOptions.put(Ljava/lang/Object;)
when open is called.
Stacktrace:
java.lang.NoSuchMethodError:…

dotmindlabs
- 778
- 1
- 12
- 35
2
votes
4 answers
setCellType(CellType.STRING) is deprecated
Issue: setCellType is deprecated.
row.getCell(0, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).setCellType(CellType.STRING);
So far tried:
Searched for replacement. No useful sources for setting a cell type as STRING. Appreciate help!

Gladiator
- 169
- 1
- 2
- 12
2
votes
1 answer
Issue with export CrossTab data into excel sheet using Java Apache POI 3.15 version
I am collecting data from my company portal and trying to export it into an excel sheet. I successfully completed for non-crosstab report data. But the issue is coming when the data has crosstab.
Data:
I have saved in data in ArrayList best on my…

Neel
- 233
- 5
- 18