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

APACHE POI - cloneStyleFrom doesn't copy BorderStyle

I've a problem with the library apache poi, i want to copy the style of a cell and to do this i use the function cloneStyleFrom() and all works good except the copy of borders style. I don't understand if is my mistake or if this function doesn't…
JBerta93
  • 699
  • 3
  • 16
  • 27
3
votes
5 answers

POI - Cannot write to file while it is opened in Excel?

I'm new on the website. I try to write to an excel file while it is opened (using POI / JAVA). I got a java.io.FileNotFoundException error when i attempt to create a file output stream to write to the file. FileOutputStream didn't work. I receive…
Jo Perone
  • 81
  • 1
  • 5
3
votes
2 answers

POI API APACHE importing to netbeans

I have read some tips in here but i still cant do import like this: import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.extractor.WordExtractor; I have add the zip file (poi-src-3.8-20120326) that downloaded from here to library…
Ahimsa Afrizal
  • 81
  • 1
  • 2
  • 9
3
votes
1 answer

How to iterate line by line through a .docx file using apache POI

My object is to read a .docx file and to display the text of that on the view(Webpage). I am using apache POI to read a .docx file in Grails Application Please suggest me a way to display the output on view without loosing Blankspaces and…
vishu
  • 195
  • 2
  • 11
3
votes
2 answers

writing a new cell to a sheet apache poi

i am using following code, for reading a excel using apache poi, its a .xlsx file. Please let me know what i can do, to also alter a value of a cell, in each row as my loop keeps going. Thanks import java.io.FileInputStream; import…
Himanshu Narula
  • 33
  • 1
  • 1
  • 3
3
votes
4 answers

Unable to read entire header; 0 bytes read; expected 512 bytes

I am using Apache poi 3.8 for reading xls file, but i got exception: java.io.IOException: Unable to read entire header; 0 bytes read; expected 512 bytes at…
Sameek Mishra
  • 9,174
  • 31
  • 92
  • 118
3
votes
1 answer

Get length of HSSFWorkbook

How I can get file size of Apache's POI HSSFWorkbook? I have code like // inside Servlet OutputStream out = response.getOutputStream(); hSSFWorkbook.write(out); And I want to add Content-Length header to response.
WelcomeTo
  • 19,843
  • 53
  • 170
  • 286
3
votes
4 answers

Java POI Create new Workbook with SS model?

I'm a little confused, I used to do this: HSSFWorkbook wb = new HFFSWorkbook(); But with the new POI, I dont have to do that. I can't do this: Workbook wb = new Workbook(); I understand WorkbookFactory.create, but that is for opening a file. How…
Doc Holiday
  • 9,928
  • 32
  • 98
  • 151
3
votes
1 answer

How to register function by poi?

Does anyone know how to register a function which cannot be implemented by poi? For example: intercept?
Sunny Wang
  • 31
  • 1
3
votes
4 answers

Apache POI and Aspose?

hi i am creating an app which can read file like pdf/doc/docx/xls/ppt etc and display it to user.I have read that if in doc there is some images and a table , apache POI can't help because it can't create borders for table.going with aspose is not…
anshul
  • 982
  • 1
  • 11
  • 33
3
votes
2 answers

How to check for emptiness of a numeric cell in Apache POI?

All is in the title. How can I check if a CELL_TYPE_NUMERIC is empty with POI ? With strings i can use the isEmpty() method but with int I have no ideas (null is not allowed and zero just wont do it). Thank you in advance.
fpillet
  • 43
  • 2
  • 8
3
votes
4 answers

org.apache.poi.poifs.filesystem.OfficeXmlFileException

i want to read a microsoft word document i.e. .docx format using POI but getting error: The supplied data appears to be in the Office 2007+ XML. POI only supports OLE2 Office documents if anyone can help me to get rid of this??
Binay
  • 149
  • 1
  • 3
  • 12
3
votes
1 answer

Using Apache POI can I stop users copying formatting?

I have made an excel sheet which is generated by Java. The cells can only accept certain values, depending on data validation done against lists on a separate sheet. This all works great, but if a user copies some values from another cell and pastes…
Ben Taliadoros
  • 7,003
  • 15
  • 60
  • 97
3
votes
1 answer

Export to excel while it contains huge data

While I am exporting excel which has huge data(ex:100 rows) I am getting below alert while opening sheet. And if we click on proceed,it is opening in protected view. While we save this excel it is alerting as "unable to save in protected view" and…
swamy
  • 1,200
  • 10
  • 23
3
votes
3 answers

How to get merged regions using apache POI's event API?

How can I get merged regions (merged cells) of an excel sheet using the event API provided by Apache POI? Using the "traditional" DOM-like parsing style there are methods called Sheet.getNumMergedRegions() and Sheet.getMergedRegion(int).…
Patter
  • 919
  • 7
  • 10