Questions tagged [hssf]

HSSF provides Java APIs to read / write Microsoft Excel 2003 and before (.xls) files. This tag should be used for questions about accessing Excel 2003 files from Java applications. HSSF is managed under the Apache POI Project.

HSSF provides Java APIs to read / write Microsoft Excel 2003 and before (.xls) files. This tag should be used for questions about accessing Excel 2003 files from Java applications. HSSF is managed under the Apache POI Project.

More information on HSSF, the bug tracker and download links are available from http://poi.apache.org/spreadsheet/index.html

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

117 questions
15
votes
1 answer

Issue with writing a date to Excel file using NPOI

I am currently using NPOI to generate Excel files based on a database from my asp.net mvc app. I'm almost done with the code, except one small issue which I keep getting when when trying to write Dates to Excel. In the database (MS SQL Server) I…
AndreiC
  • 1,490
  • 4
  • 16
  • 34
11
votes
8 answers

How do I get the (Java Apache POI HSSF) Background Color for a given cell?

I have an existing excel spreadsheet, which I am accesssing and reading values from, I am using Apache POI HSSF. It is initialised like this: HSSFSheet sheet; FileInputStream fis = new FileInputStream(this.file); POIFSFileSystem fs = new…
java
  • 151
  • 1
  • 2
  • 6
8
votes
4 answers

Apache POI, using both XSSF and HSSF

I have a problem with Apache POI project. I failed to use XSSF and HSSF in the "Same Java Class". Which jar should I download or which artifact should I get add into maven? I want to handle both xls and xlsx files at the same time. When I get excel…
Tim Tuckle
  • 1,372
  • 7
  • 21
  • 31
8
votes
4 answers

Apache POI-HSSF distorts image size when adding picture into Excel cell

I am adding a picture into a cell using Apache POI-HSSF. The image is 120x100 but no matter what I do and how I resize it, the Excel spreadsheet always shows it spanning multiple rows and distorts it to a much bigger height than width. How do I keep…
gene b.
  • 10,512
  • 21
  • 115
  • 227
7
votes
5 answers

Which library should I use to write an XLS from Linux / Python?

I'd love a good native Python library to write XLS, but it doesn't seem to exist. Happily, Jython does. So I'm trying to decide between jexcelapi and Apache…
Jeremy Dunck
  • 5,724
  • 6
  • 25
  • 30
5
votes
3 answers

How to use rowiterator in apache poi with java?

I tried to read an excel file using apache poi in java, however, Eclipse did not compile the code. public class ReadExcel { public static void main(String[] args) throws IOException { FileInputStream file = new FileInputStream(new…
Aleksei Nikolaevich
  • 325
  • 3
  • 15
  • 40
4
votes
2 answers

In Apache POI HSSF, Cell Type Still Shows Up as "General" Excel, Even Though it's Number-Formatted

I am using Apache POI HSSF to generate an Excel spreadsheet from my Java Web app. I need a cell formatted as "Number" with 2 decimal points. (My values in Java are BigDecimals, but I can convert them to doubles, no problem.) I am using this…
gene b.
  • 10,512
  • 21
  • 115
  • 227
4
votes
3 answers

Recalculating formulas in spreadsheet using Apache POI

I'm trying to use POI XSSF to evaluate some Excel formulas. The values do not have to be saved, and I may have to calculate many formulas, so I'm trying to do it all in the same cell. The problem is that the cell value seems to get stuck on the…
qwerty
  • 515
  • 1
  • 9
  • 14
4
votes
1 answer

Regarding HSSF Sheet issue(Invalid row number (65536) outside allowable range (0..65535) exception)

I am using Excel 2007 and it supports 1,048,576 rows but through my code it displays only 65,536 rows. If data is more than 65,536 rows I am getting the exception as Invalid row number (65,536) outside allowable range (0..65535). I used HSSF API.how…
Manikanta
  • 89
  • 2
  • 14
4
votes
1 answer

Apache-POI: Cell Background Color doesn't work

I'm trying to configure generic CellStyles for formating HSSFCells using Apache-POI 3.11. Here is a runnable sample of the code. The bold and border formating is being correctly aplied. The problem is with the Background and Foreground colors. Any…
Netto
  • 284
  • 2
  • 10
3
votes
1 answer

Set active cell in HSSFWorkbook

I'm trying to create an old-style Excel document (HSSFWorkbook) with a particular cell preselected, using Apache POI 3.17. The below code is really ugly (it uses reflection and private fields) but gets the job done. Is there a better way to achieve…
2
votes
1 answer

POI's HSSF dataformat - what colors are supported?

When colorizing numbers (black for positive numbers, red for negative numbers), I usually use this snippet: style.setDataFormat(format.getFormat("[Green]#,##0;[Red]#,##0")); Ive seen some variation like this one below but Im not sure what COLOR 5…
StephenNYC
  • 1,234
  • 3
  • 12
  • 29
2
votes
1 answer

Set page view mode in excel file using apache poi

Excel has different modes for viewing a sheet: Normal, Page Layout, Page Break Preview. (In excel 2010: in the view tab). The view mode is saved seperately for each sheet in a workbook and is restored when opened again. I am trying to find a way to…
EliK
  • 103
  • 1
  • 6
2
votes
1 answer

How to set excel cell background color with System color in NPOI

I have an object of class Foo with attribute StatusColor being used in multiple locations. Now, I have to generate an Excel file using NPOI in which the column Status Color should have the same color as the object. I do not know how to set…
Prem
  • 316
  • 1
  • 5
  • 23
2
votes
1 answer

Change background color of row with Apache POI

I try to use Apache POI to change background colors of cells in a row. I use following code to handle it in xls file, but there aren't any changes in file after execution. FileInputStream fis = new FileInputStream(src); HSSFWorkbook wb = new…
plaidshirt
  • 5,189
  • 19
  • 91
  • 181
1
2 3 4 5 6 7 8