Questions tagged [xssf]

XSSF provides Java APIs to read / write Microsoft Excel 2007 (OOXML format .xlsx) files. This tag should be used for questions about accessing Excel 2007 files from Java applications. XSSF is managed under the Apache POI Project. Other tag to consider: [tag:apache-poi]

HSSF is the POI Project's pure Java implementation of the Excel '97(-2007) file format. XSSF is the POI Project's pure Java implementation of the Excel 2007 OOXML (.xlsx) file format.

If you are starting with Apache POI, you may find the Busy Developer's link very useful: http://poi.apache.org/spreadsheet/quick-guide.html

Useful links

488 questions
8
votes
2 answers

How to check if date uses 1904 windowing with Apache POI XSSF eventmodel

I am writing a program that imports xlsx files with Apache POI eventmodel (SAX/XSSF). I am almost done, but I can't get the correct dates. I am parsing a cell with date value 41319.558333333334 I am using the…
SWilk
  • 3,261
  • 8
  • 30
  • 51
7
votes
1 answer

How to get the max no. of columns filled in an XLSX file using POI?

I know we can get the max number of columns by iterating over all the rows and calling getLastCellNumber on each row object.. but this approach requires iterating over all the rows which I want to avoid since it will take lot of time for files with…
rirhs
  • 297
  • 2
  • 4
  • 9
7
votes
1 answer

Apache POI background color style seems not working

Good evening! I've some trouble with apache poi v. 3.14, when I open the rendered xlsx with Libreoffice or Excel the style is not applied correctly. I have this code: class... { private XSSFCellStyle doubleLockStyle; /** * Create default cell…
Delayer
  • 409
  • 1
  • 5
  • 17
7
votes
1 answer

Getting error "Your InputStream was neither an OLE2 stream, nor an OOXML stream" when created file through apache POI

I am trying to check if my excel file already exists. If it doesn't exists, I want to create a new one and if it exists I will delete it and create a new one. I wrote following program but I am getting error at line - workbook=…
For Testing
  • 281
  • 2
  • 5
  • 19
7
votes
2 answers

How can I get the workbook file name i.e. excel file name

I am working on an existing .xlsx file. Can any one share with me that, how can I get my current file name? I mean, suppose I am working on test.xlsx file. How can I get the name of workbook "test.xlsx" using apache poi.
Sankumarsingh
  • 9,889
  • 11
  • 50
  • 74
6
votes
2 answers

How to transpose sheet with POI SS/XSSF?

I am using POI XSSF API and I would like to transpose a sheet. how can I do that? Thanks.
Yoni
  • 553
  • 3
  • 14
  • 24
6
votes
2 answers

Change Data Range in Excel Line Chart using Apache POI

I am trying to see if it is possible to change the data range of a series in a line chart using Apache POI. I am able to pull the series from the chart itself, but cannot find a method that allows me to change the data range. XSSFWorkbook workbook =…
6
votes
1 answer

How to get the position/index of a Sheet object in Java Apache POI

In a Java method, I am using an Apache POI Sheet (from XSSFWorkbook). I can read the sheet name using getSheetName() method. But is there any way to find the sheet position in the workbook? I don't see any methods like getSheetIndex() in the Sheet…
Saikat
  • 14,222
  • 20
  • 104
  • 125
6
votes
0 answers

How to create two XSSFWorkbook objects with the same bytes

I am trying to write a test to check that an Excel file I have created in code is exactly the same as a resource file (same formatting, same cell contents, etc). One idea was to convert to byte arrays and check that the byte arrays are equal.…
cpp beginner
  • 512
  • 6
  • 23
6
votes
1 answer

How to write to an existing file using SXSSF?

I have an .xlsx file with multiple sheets containing different data. Of all the sheets one sheet needs to accommodate close to 100,000 rows of data, and the data needs to be written using Java with poi. This seems quite fast and simple with…
user3806245
6
votes
1 answer

apache poi - XSSF read formatted cell value

Is there any way I can get to the formatted value that excel shows in a row, versus the raw value I am getting returned from the stream? Or would this fall under the "formula evaluation" category, which this does not support?
Adam Davis
  • 71
  • 1
  • 2
6
votes
3 answers

Why won't Apache POI OPCPackage close() method save/write contents to open writable file?

Using the following code, cell value changes made to my Excel Spreadsheet are not saved: OPCPackage pkg = OPCPackage.open(inputFile); XSSFWorkbook wb = new XSSFWorkbook(pkg); ModifyWorkbook(); pkg.close(); The following is a workaround I wrote,…
DanielReid
  • 63
  • 1
  • 4
5
votes
3 answers

How to create sheet with right-to-left alignment using Apache POI XSSF

I'm trying to create a sheet in the Excel file using Apache POI. Since it's Excel 2007, I'm using XSSF and I'm looking a for way to make a sheet right-to-left aligned. In HSSF there is a method…
Tarlog
  • 10,024
  • 2
  • 43
  • 67
5
votes
1 answer

How to evaluate a excel formula through XSSF event API

I am reading XLSX files using event API of Apache POI, i.e I read the contents of the XLSX sheet through a SAX Parser. I want to know how can we get the computed value of a formula by using XSSF event API. The way I know to do this is by using the…
rirhs
  • 297
  • 2
  • 4
  • 9
5
votes
6 answers

How can I read .xlsx and .xls files in Java?

hi i want to read xlsx file or xls file what ever it is. can XSSF support xls file ? or do i need to write the separate code for both kind of files ?
Srinivas
  • 51
  • 1
  • 1
  • 2
1 2
3
32 33