I have a workbook with two sheets: Sheet1 Sheet2 And there is a sequence on Sheet2 at the range of A1 to A5: aa bb cc dd ee And in Sheet1, the cell A1 is validated by the sequence in Sheet2. Excel screenshot However, sheet.getDataValidations() returns an empty list for this case. Did I miss something? “[] 0” was printed
Tag: apache-poi
Apache POI – Is there a way to count occurrence of a string in a pivot table?
I am using version 4.1.2 of Apache Poi and I have this dataset: I’m trying to create a pivot table using Apache POI that groups and counts the occurrence of strings from the 2nd column. I’ve tried: But it somehow still counts the occurrences from the first column. The pivot table I’m trying to create: and the pivot table that
SUM(ABOVE) functionality in apache poi or docx4j
I am trying to implement =SUM(ABOVE) function in docx which is used to sum all elements above to tht column. I was able to implement this with apache poi using : This is ok when someone opens the document and it calculates it. But if I need to convert the document without opening it to pdf then this function doesnt
Create Java Apache POI Line Chart where Dates appear on the horizontal X-axis
I’m trying to create a simple line chart using the Java Apache POI which is essentially a time series, consisting of a Date and a numeric value: I would like for the dates to appear on the x-axis. However, this seems to be difficult to achieve. I can do it manually in Excel but not via the API. Answer This
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 here: https://github.com/apache/poi/blob/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java#L581 I’m getting IllegalArgumentException(“amountToMove must not be zero”) from FormulaShifter.java: https://github.com/apache/poi/blob/trunk/src/java/org/apache/poi/ss/formula/FormulaShifter.java#L80 It seems that the problem is at line 623 of XSSFRow where
find and replace a text in different header for each section in docx using java
I am trying to find and replace a text different sections of header in each page using Apache poi but getting only null data, but Docx has different header sections and footer too 1.Screen shot of Docx header sections. 2.Screen shot of Docx header another section. 3.Screen shot of Docx header another section. 4.Screen Shot Answer In a *.docx document,
Docx to Pdf Converter in java
The below code is not working with Apache poi 3.16. Can someone provide with the correct solution, in my project there are some dependency for using only Exception: Answer The main problem with this is that those PdfOptions and PdfConverter are not part of the apache poi project. They are developed by opensagres and first versions were badly named org.apache.poi.xwpf.converter.pdf.PdfOptions
Apache POI – Conditional formatting – need to set different cell range for rule and formatting
I am trying to create an empty excel template using apache poi java. I need to add a rule – when column no. 3 is populated then columns from 7 to 12 need to be highlighted in some color (as a mandatory indicator for the user). I could find below code which colors the cell when the condition is met
Apache POI java.lang.NoSuchMethodError
My code is below: And the error code I get is: The dependencies for Apache that I have added to my netbeans library are: And from here I pretty much have no idea what to do. Can anyone tell me if my code is wrong or what other dependencies I need? Answer Ok, so as rgettman explained, I had to
Replace text templates inside .docx (Apache POI, Docx4j or other)
I want to do replacements in MS Word (.docx) document using regular expression (java RegEx): I tried to get text templates (like %SOME_TEXT%) use Apache POI – XWPF and replace text, but replacement is not guaranteed, because POI separates runs => I get something like this(System.out.println(run.getText(0))): code example: I have found many similar questions (like this “Replacing a text in