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

Section | Word using Apache POI

I would like to know if it is possible to block sections on Word using Apache POI. and if anyone has any examples or tutorials that could help me.
Rodrigo Sasaki
  • 7,048
  • 4
  • 34
  • 49
2
votes
1 answer

Java read excel

I am trying to read this file I created as sample made up from 4 columns and 1 row. The code below was taken to test the API i am using i.e. Apache POI.. package testjavaexcel; import java.io.FileInputStream; import…
sys_debug
  • 3,883
  • 17
  • 67
  • 98
2
votes
1 answer

How to auto size a row height in apache poi?

I need to adjust the height of a row depending on the content. Is there a method like cell.autoSizeColumn() to do this?
Saicharan S M
  • 828
  • 3
  • 11
  • 25
2
votes
2 answers

Is it possible to append 2 rich text strings?

I need to append to 2 HSSFRichTextStrings in Java with Apache POI. How can I do this? What I'm exactly doing is I'm getting the rich text string already present in a cell and I'm trying to append an additional rich text string to it and write it…
Saicharan S M
  • 828
  • 3
  • 11
  • 25
2
votes
1 answer

Default document font size of doc/docx documents

I am trying to find the default font size of a doc/ docx document using apache poi. I have used the XWPFRun class method getFontSize(). But it returns the value -1 if the font size is default. I couldn't find any other method that returns the same…
srjit
  • 526
  • 11
  • 25
2
votes
1 answer

Writing to a existing xls file using POI

The scenario is roughly this: I have a java program with several methods getting called randomly. The first method will create an xls file using apache POI and will put the headers for the columns. All the other methods has to write a record into…
Vicky
  • 16,679
  • 54
  • 139
  • 232
2
votes
1 answer

Get picture position in Apache POI from Excel xls HSSF

My need is to get a picture data as bytes, then it's anchor details and finaly display the result on screen at target position and size for my users... The API shows we can get a list of all pictures through workbook object like this:…
A. Masson
  • 2,287
  • 3
  • 30
  • 36
2
votes
1 answer

POI's HSSF dataformat - what colors are supported?

When colorizing numbers (black for positive numbers, red for negative numbers), I usually use this snippet: style.setDataFormat(format.getFormat("[Green]#,##0;[Red]#,##0")); Ive seen some variation like this one below but Im not sure what COLOR 5…
StephenNYC
  • 1,234
  • 3
  • 12
  • 29
2
votes
3 answers

illegal character error in java

i am trying to read an excel file using java. while compiling the program i am getting error as illegal character. help me to fix this problem. here is the code import java.io.IOException; import java.io.*; import java.util.Iterator; import…
darsha
  • 61
  • 1
  • 9
2
votes
1 answer

Java poi getting wrong column count when reading MS Word tables

I'm using poi to read tables from MS Word 2003. The tables in doc file has 4 columns and 100 rows,the fourth column could be empty, the others couldn't. When iterating each row to get column count, some row returns 4, while others returns 3. My…
Shuo
  • 333
  • 1
  • 5
  • 18
2
votes
1 answer

Java Apache POI : Writing Workbook to ServletOutputStream hangs until button clicked in client browser

This code creates a workbook and send it to client browser. It's almost fine, response is sent back to browser and a nice popup opens up in browser asking to save, open file, or cancel the whole operation. Classic. The thing is, if I debug this…
Mat
  • 1,309
  • 1
  • 20
  • 43
2
votes
4 answers

java - Is it possible to check current used heap space at runtime?

I'm writing an app the generates a big xlsx file using apache-POI. At a certain time I get OutOfHeapSpace exception. I want to solve it by writing the content to the xlsx file when I determine that I'll soon be out of space, and thus freeing the…
AAaa
  • 3,659
  • 7
  • 35
  • 40
2
votes
1 answer

Is it possible to determine font family used in an excel cell using apache POI library

I'm using POI library to read excel sheets, xls and xlsx. I'm wondering if there is a way for me to determine what font family is used for a given cell. I'm specifically interested in determining if the font family is "symbol", where "m" is…
David Zhao
  • 4,284
  • 11
  • 46
  • 60
2
votes
4 answers

How to Convert a ppt file into pdf file in Java?

I want to convert an MS powerpoint (ppt) document to PDF. I searched some jars like officetools.jar, but that requires purchase. Is there any way I can convert it through itext and apache POI like we do for doc to PDF?
user1037487
  • 29
  • 1
  • 1
  • 2
2
votes
3 answers

How to free up the memory from a Apache POI workbook once the task is over?

I have opened a large excel file as a Apache POI workbook (using VM args to set max memory size) After successfully opening the file, I read the required data and finished my work. Now I want to continue further in the programming with other tasks…
Jeril Nadar
  • 175
  • 3
  • 10