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

How to handle HYPERLINK function using POI SS?

I'm trying to use POI SS to convert an Excel spreadsheet to CSV. Unfortunately I can't seem to handle HYPERLINK functions properly: if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) { System.out.println("formula cell: " + cell.toString()); …
Peter
  • 837
  • 3
  • 14
  • 19
2
votes
1 answer

How to make a table in console in Java and POI using printf/formatter with generic data type

I am fairly new to stack overflow and I am trying to make a table in my console, but when I try to use printf for padding or java's Formatter, I can't seem to fit it in my code as the cell could be any type. package com.codeblit.IO; import…
Blitzer
  • 134
  • 1
  • 6
2
votes
2 answers

Apache POI XSSFWorkbook throwing NullPointerException for file

I have checked every possible question on here with a similar problem, and none of the solutions have worked. I feel like I am missing something really obvious, but I just can't see it. I am on Windows 10, using Eclipse 2019, and the newest Apache…
2
votes
0 answers

Apache POI XWPF Word document is Losing Page Number when converted into PDF

I'm generating a word document using Apache POI XWPF. this document includes a footer with Page number but when I convert this word document into PDF, the page number is not displayed: XWPFRun run = paragraph.createRun(); XWPFFooter footer =…
tiamat
  • 879
  • 2
  • 12
  • 35
2
votes
1 answer

How to get the absolute position of child shapes by using apache poi

This is a groupShape with a child shape:
we1
  • 71
  • 7
2
votes
1 answer

JavaFX Apache POI Excel Login Program

I am new to Java and I've been studying it for a while now I want to make a login program using excel to store the information. The problem is that I don't know how to code the log in button. I searched and came up with this code using iterator to…
Yiue
  • 23
  • 5
2
votes
1 answer

Java Word Appache POI - Vertically align cell content / remove space after text

My table look like this: Word POI Table As you can see the text is aligned to the top of a cell. I want to have it centered vertically or aligned to bottom of the cell.. I tried to achieve it with cell.setVerticalAlignment(XWPFVertAlign.CENTER); but…
Fei
  • 45
  • 5
2
votes
0 answers

Problem with Writing Excel file multiple time

My code is trying to Uploading the user data to an excel file. When user enter the data from the app for the first time, it writing the data to the excel file. But the problem came when the user try insert data for the second time. It just writing…
2
votes
1 answer

Apache poi add label in excel chart

public class LineChart { public static void main(String[] args) throws IOException { try (XSSFWorkbook wb = new XSSFWorkbook()) { XSSFSheet sheet = wb.createSheet("linechart"); final int NUM_OF_ROWS = 3; …
leibin
  • 35
  • 6
2
votes
1 answer

Apache POI - CellDataFormat Exception

I'm trying to create an excel file(.xlsx) and fill it with data using Apache POI, and formatting some cells to an Accounting format, using: CellStyle CellAccounting = spreadsheet.getWorkbook().createCellStyle(); CreationHelper ch =…
Chris
  • 23
  • 5
2
votes
0 answers

How to write excel file data to OutputStream

I have a Java based web app that downloads data into an excel file. I'm using Apache poi 4 to prepare workbook (org.apache.poi.xssf.streaming.SXSSFWorkbook). I checked the write method of workbook class, it does write data into an output stream.…
Ravi Nain
  • 605
  • 8
  • 16
2
votes
1 answer

Apache POI Write to Excel Works in Eclipse but not after compiling to Jar in OpenJDK 11

I have a project which involves writing to an Excel spreadsheet (.xlsx) using Apache POIs XSSFWorkbook() class. It worked fine in a previous version of Apache POI for Java 8. Recently we migrated our code base to OpenJDK 11 and updated our Maven…
Chris Toh
  • 88
  • 1
  • 11
2
votes
2 answers

How to insert a background image for an Excel Comment in .xlsx formats (Apache POI XSSF)?

There is a question which solves how to add a background image for an Excel Comment in versions previous to 2007 (format .xsl), with HSSF Apache POI. apache poi insert comment with picture But looking the doc, I cannot locate an equivalent method…
Strings
  • 23
  • 4
2
votes
2 answers

Groovy/POI Returning Different Iterators on Different Systems

I have the following code. Its purpose is to run through an xls file using POI and write all the data to a txt file. for ( sheetNumber in 0..numberOfSheets-1) { HSSFSheet sheet = workBook.getSheetAt(sheetNumber) Iterator rows =…
KevinO
  • 970
  • 2
  • 13
  • 31
2
votes
1 answer

Exception in org.apache.poi

I was trying to write a program that it can read and write a .xlsx file, the code provided below is designed to be able to write its first excel program. package excel_reader; import java.io.FileOutputStream; import java.io.IOException; import…
FlashSonic526
  • 101
  • 6
  • 12