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

Number and cell Formatting in apache poi

I am creating excel sheet using apache poi. I have numbers like - 337499.939437217, which I want to show as it is in excel without rounding off. Also the cell format should be number (for some columns) and currency (for some columns). Please suggest…
22
votes
5 answers

Streaming a POI workbook to the servlet output stream

I build a very large POI workbook, on my web server. Holding the entire workbook in memory , will not scale for multiple concurrent requests. Is there a way i can progressively write the workbook to the servlet output stream. That should reduce the…
The Machine
  • 1,221
  • 4
  • 14
  • 27
22
votes
6 answers

POI performance

I am using POI in my J2EE web application to generate a workbook. However, i find that POI takes around 3 mins to create a workbook with 25K rows(with around 15 columns each). Is this a POI performance issue , or is it justified to take that much of…
The Machine
  • 1,221
  • 4
  • 14
  • 27
22
votes
4 answers

Apache POI or docx4j for dealing with docx documents

What do you think Which is better to use to read docx document as java objects and why ? in other words. which library supports most of the word tags ?
becks
  • 2,656
  • 8
  • 35
  • 64
22
votes
2 answers

Apache POI 3.9 : WorkbookFactory method not found

In my app I have used Apache POI 3.8 for XLS file processing. Now I want to migrate to Apache POI 3.9 latest and stable version. I have added the JAR file poi-3.9-20121203.jar in my application and removed JARs related to POI 3.8. But it seems that,…
Gunjan Shah
  • 5,088
  • 16
  • 53
  • 72
22
votes
7 answers

Using Apache POI how to read a specific excel column

I'm having a problem in excel while using Apache POI. I can read across rows, but sometimes I'm in a situation where I would like to read a particular column only. So is it possible to read any particular column like only the 'A' column only or the…
selva
  • 223
  • 1
  • 3
  • 6
21
votes
6 answers

MalformedByteSequenceException: Invalid byte 2 of 2-byte UTF-8 sequence

I have a xml file which contains arabic characters.When i try to parse a file,it arise the Exception,MalformedByteSequenceException: Invalid byte 2 of 2-byte UTF-8 sequence.I Use POI DOM for parse the document. The Log is, 2012-03-19 11:30:00,433…
21
votes
7 answers

Exception when writing to the xlsx document several times using apache poi 3.7

I am getting the following exception while trying to write an .xlsx file using Apache POI: org.apache.xmlbeans.impl.values.XmlValueDisconnectedException It seems the problem is using the method write () second time. When working with a HSSFWorkbook…
Mihail
  • 341
  • 1
  • 2
  • 11
21
votes
2 answers

Get Cell Value from Excel Sheet with Apache Poi

How to get cell value with poi in java ? My code is look like this String cellformula_total__percentage= "(1-E" + (rowIndex + 2) + "/" + "D" + (rowIndex + 2) +…
Ravi Parmar
  • 1,392
  • 5
  • 24
  • 46
21
votes
3 answers

Replacing variables in a word document template with java

I want to load a template word document to add content to and save as new document. I'm working on .doc file. After a long research I only found solutions for docx :…
Amira
  • 3,184
  • 13
  • 60
  • 95
21
votes
2 answers

using poi , How to set the Cell type as number

I am using poi 3.6 I am able to create the excel properly. But when I trying to set the cell type as number , it always give me cell type as general. i.e. In the newly create excel , when I right click and go to format cell ->there I always found…
Anup
  • 405
  • 2
  • 10
  • 26
21
votes
3 answers

Create an excel file for users to download using Apache POI

I'm able to create an excel file using apache poi. however, i want users to be able to download this as a "true" excel file. the effect i want to achieve would be to have a popup box allowing the user to download the file. this is similar to using…
user571099
  • 1,491
  • 6
  • 24
  • 42
20
votes
6 answers

Is there a Scala wrapper for Apache POI?

I would like to use Apache POI to read/create Excel files in an Scala app. Sure, I can use the POI library directly, it's Java after all, but I would like to have the Scala feel. So is there a Scala wrapper bringing the Scala feel (using implicit…
Peter Kofler
  • 9,252
  • 8
  • 51
  • 79
20
votes
2 answers

integrating org.apache.poi and the javax.xml.stream.* package (stax-api) in android - how to set the --core-library argument in Android Studio?

I'm using Android studio 1.5.1 I'd like to include the org.apache.poi-ooxml library in my android project. To include that library I needed to include some other library dependencies, among which the stax-api library. The problem with stax api is…
SlumpA
  • 882
  • 12
  • 24
20
votes
8 answers

Finding the last row in an Excel spreadsheet

I'm trying to find the index of the last row in an excel spreadsheet using Apache's POI for Java. I thought this should be possible with getLastRowNum() or getPhysicalNumberOfRows() but they don't seem to give the right results. For example, I have…
FromCanada
  • 376
  • 1
  • 4
  • 12