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

Excel sheet removing zero(s) for number starting with zero(s)

I need to write CSV/Xls file with a column having numbers like 00078, but even after writing the number as a string, excel sheet displays it as 78. I have tried apache poi library and try setting cell type to String. HSSFWorkbook workbook = new…
2
votes
1 answer

Split a XWPFRun into multiple runs

I am trying to modify existing Word documents by automatically bolding some keywords in them. As an example: The quick brown fox jumps over the lazy dog. (1) would become: The quick brown fox jumps over the lazy dog. (2) My issue is that (1) is…
jgp
  • 2,069
  • 1
  • 21
  • 40
2
votes
2 answers

Copy and paste rows with HSSF (Apache POI)

Possible Duplicate: How to insert a row between two rows in an existing excel with HSSF (Apache POI) How can I copy the values and all the formatting of a row using HSSF. Using the MS Excel or other Spread Sheet application it is easy as copy and…
ace
  • 6,775
  • 7
  • 38
  • 47
2
votes
3 answers

How to read empty cell in excel file using poi and how to add this empty cell to array list?

public void readExcel(String fileName) try { FileInputStream myInput = new FileInputStream(fileName); POIFSFileSystem myFileSystem = new POIFSFileSystem(myInput); HSSFWorkbook myWorkBook = new…
veda
  • 31
  • 1
  • 1
  • 3
2
votes
2 answers

Apache POI Date Parsing One Second Off

I'm parsing an Excel spreadsheet with a date in it. The results from POI are off by 1 second compared to what's displayed in Excel. The unformatted data in Excel is: 43261.5027743056 The cell in Excel has a format of: mm/dd/yyyy hh:mm:ss The field…
MSquared
  • 322
  • 3
  • 15
2
votes
4 answers

Why can't I prevent Apache POI from altering the source file?

I am opening an Excel file (the source) in Java using an Apache POI Workbook, altering data in a certain set of cells, saving the Workbook to a separate file, then closing the Workbook (because the documentation states to close the Workbook, even if…
JoshDM
  • 4,939
  • 7
  • 43
  • 72
2
votes
1 answer

Apache POI - CellStyles applied to cells on cloned sheet appear on original sheet

In a program I'm writing, I prepare an excel sheet ("master") and clone it multiple times. Each time I clone this master sheet I apply CellStyles to specific cells on the new cloned sheet. The problem is, every time I apply CellStyles to the cells…
Mike
  • 706
  • 7
  • 16
2
votes
0 answers

Error reading special characters from Excel (".xls") file

I'm currently trying to read an .xls file from java that has the character '°' in the first row but i'm getting an error on the HSSFWorkbook constructor. FileInputStream fileInputStream = new FileInputStream(new File(path)); HSSFWorkbook workbook =…
Stefano
  • 21
  • 3
2
votes
0 answers

Enable sorting in protect Sheet Apache POI

After protected the sheet. sheet.protectSheet(""); Not able to enable sorting. The new version of POI. Not have an argument to enable the sortingin a protected sheet. It has only to disable sorting. sheet.lockSort(); I tried this…
Joel Java
  • 21
  • 3
2
votes
1 answer

Java apache POI set metadata

I'm using Apache POI to generate excel reports. But the properties of the excel file clearly mention that I have used Apache POI. I want to mention my software name instead here This is my current code, where I'm trying to set a custom property but…
mrid
  • 5,782
  • 5
  • 28
  • 71
2
votes
1 answer

Unable to write and save XLSM file with Apache POI

I have an existing XLSM file, in which I try to write data with use of Apache POI. String File = GlobalVariables.XLSM; try { Workbook workbook; workbook = new XSSFWorkbook(OPCPackage.open(GlobalVariables.XLSM)); Sheet sheet =…
plaidshirt
  • 5,189
  • 19
  • 91
  • 181
2
votes
2 answers

java.lang.IllegalArgumentException: Attempting to write a row[1] in the range [0,1] that is already written to disk

While Download xlsx using apache poi version 3.15 in ubuntu it is giving me: java.lang.IllegalArgumentException: Attempting to write a row[1] in the range [0,1] that is already written to disk at…
Ankit
  • 31
  • 1
  • 1
  • 3
2
votes
1 answer

Apache-poi decimal formatting is being applied only after selection

Could you please suggest on next case? I`ve set up dataformat and cell type ("#,###.00", NUMERIC) (I want thounsand separator plus two decimal numbers) It works as I expected but to have formatted cells I need to select them first Before selection…
A.Khvorov
  • 45
  • 1
  • 9
2
votes
1 answer

Java - NoClassDefFoundError XSSFWorkbook

I creating CSV to XLSX app - My first question Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook at com.test.csv2xlsx.Csv2Xlsx.(Csv2Xlsx.java:35) at…
Jan Sršeň
  • 1,045
  • 3
  • 23
  • 46
2
votes
1 answer

How to unmerge cell through java using poi and get the data for xssf format

I have an existing excel sheet and I am trying to read it and put it in my list. But, there are merged cells so i wanted to unmerge before storing it in my list. I tried the removeMergedRegion() method but it didn't work. when i open the excel sheet…
1 2 3
99
100