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

how to create appendable excelsheet using java

I want to create an append-able excel sheet. Like i have four columns stream1 stream2 stream3 stream4 first time i am inserting data only first column(stream1) after that i want to full fill other columns one by one. this is the code which i am…
narendra
  • 451
  • 3
  • 12
11
votes
2 answers

XSSFWorkbook takes a lot of time to load

I am using the following code: File file = new File("abc.xlsx"); InputStream st = new FileInputStream(file); XSSFWorkbook wb = new XSSFWorkbook(st); The xlsx file itself has 25,000 rows and each row has content in 500 columns. During debugging, I…
London guy
  • 27,522
  • 44
  • 121
  • 179
11
votes
3 answers

Java: Apache POI: Can I get clean text from MS Word (.doc) files?

The strings I'm (programmatically) getting from MS Word files when using Apache POI are not the same text I can look at when I open the files with MS Word. When using the following code: File someFile = new…
CosmicGiant
  • 6,275
  • 5
  • 43
  • 58
11
votes
6 answers

Refresh Pivot Table with Apache POI

I'm currently working on a Java application that uses a template excel file that contains a pivot table. The template file also has a data sheet that seeds the pivot table. This data sheet is dynamically loaded in the java application through the…
B Jammin
  • 281
  • 1
  • 3
  • 7
10
votes
2 answers

Error while reading Excel sheet using Java

I'm working with Spring/Hibernet using NetBeans 6.9.1. I'm trying to read an Excel file (.xlsx- Office 2007). The code for reading an Excel file is as follows using a Vactor to store data from the Excel sheet. import java.io.FileInputStream; import…
Bhavesh
  • 4,607
  • 13
  • 43
  • 70
10
votes
6 answers

how to add a picture to a .docx document with Apache POI XWPF in java

I've created a simple docx-Document, using Java POI 3.7. XWPF. Then, I added a picture by using the Method XWPFDocument.addpicture(byte[] arg0, int arg1). XWPFDocument docx = new XWPFDocument(); XWPFParagraph par = docx.createParagraph(); …
tsd.tom
  • 101
  • 1
  • 2
  • 8
10
votes
3 answers

How to select and bold the whole worksheet with Apache POI

I am a beginner with Apache POI library. in VBA, I know I can select and bold the whole worksheet with following code Dim ws As Worksheet Set ws = ThisWorkbook.Sheets(1) ws.Cells.Font.Bold = True May I know how to select and bold the whole sheet by…
mememoremore
  • 282
  • 1
  • 4
  • 15
10
votes
2 answers

changing location of temp files created using Apache POI

I am stuck with an issue with reading .xlsx file. Some temporary files with random name are created under /tmp/poifiles directory whenever I use WorkbookFactory.create(inputStream);. This directory is created with RW-R-R- permission for the first…
ronak.patel
  • 273
  • 1
  • 2
  • 9
10
votes
1 answer

Trying to make simple PDF document with Apache poi

I see the internet is riddled with people complaining about apache's pdf products, but I cannot find my particular usecase here. I am trying to do a simple Hello World with apache poi. Right now my code is as follows: public ByteArrayOutputStream…
AlexK
  • 336
  • 8
  • 21
  • 41
10
votes
3 answers

How to print a number greater than 7 digits using poi(2.5) from excel sheet in the console using java

while retrieving the value it is giving in the exponential format for big numbers. while (cells.hasNext ()) { HSSFCell cell = cells.next (); System.out.println ("Cell No.: " + cell.getCellNum ()); /* * Now we will get the cell type and display…
sumit
  • 101
  • 1
  • 3
10
votes
1 answer

Why can't I link one workbook to another in Apache POI?

I have one workbook that has some data in it. I am taking that workbook and creating another workbook with a line chart in it based off of the data in the other workbook. The code runs fine, but whenever I open up the graph file, I get the warning…
ack
  • 1,181
  • 1
  • 17
  • 36
10
votes
3 answers

java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTWorkbook$Factory

I use example: http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/ss/examples/BusinessPlan.java This is my dependencies list: junit
Vy Do
  • 46,709
  • 59
  • 215
  • 313
10
votes
2 answers

Detect needed print orientation with Apache POI

I'm using Apache POI to create xls spreadsheets. Is there a way to detect if the data fits in portrait mode or if I have to set the sheet to landscape mode? I know how to set the modes, but I don't know how to find out if the data fits the current…
black666
  • 2,997
  • 7
  • 25
  • 40
10
votes
1 answer

Apache POI Parsing error

I know this question has been asked often, but couldn't find a suitable solution. When working with XWPFDocument xdoc = new XWPFDocument(srcFile); or XSSFWorkbook workbook = new XSSFWorkbook(srcFile); I always end up with the following…
beingsuplab
  • 155
  • 1
  • 1
  • 12
10
votes
4 answers

File is corrupted after creating excel (.xlsx) file by using Apache POI with Java

I have created a Workbook/Excel in .xlsx format with Java using Apache POI API successfully. My code is as below that is created a file named "RiponAlWasim.xlsx" in D drive: Workbook wb = new XSSFWorkbook(); FileOutputStream fileOut = new…
Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176