Questions tagged [poi-hssf]

HSSF is the Apache POI project's Java API for manipulating Excel format files (.xls and .xlsx)

The POI-HSSF tag is used for Apache POI Project's Java API for manipulating Excel format files (.xls and .xlsx).

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.

This tag should be used for questions around using and extending Apache POI HSSF.

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

165 questions
58
votes
8 answers

How to insert a row between two rows in an existing excel with HSSF (Apache POI)

Somehow I manage to create new rows between two rows in an existing excel file. The problem is, some of the formatting were not include along the shifting of the rows. One of this, is the row that are hide are not relatively go along during the…
ace
  • 6,775
  • 7
  • 38
  • 47
55
votes
7 answers

How to get row count in an Excel file using POI library?

Guys I'm currently using the POI 3.9 library to work with excel files. I know of the getLastRowNum() function, which returns a number of rows in an Excel file. The only problem is getLastRowNum() returns a number with the count starting from 0. So…
Ahmad
  • 12,886
  • 30
  • 93
  • 146
51
votes
3 answers

Setting foreground color for HSSFCellStyle is always coming out black

I am using POI to create an Excel spreadsheet in Java. I have the following code used for creating a header row: HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("Report"); // some more code HSSFRow row =…
Ascalonian
  • 14,409
  • 18
  • 71
  • 103
32
votes
5 answers

Reading date values from excel cell using POI HSSF API

I'm using POI HSSF API for my excel manipulations in Java. I've a date value "8/1/2009" in one of my excel cell and while I try to read this value using HSSF API, it detects the cell type as Numeric and returns the 'Double' value of my date. See the…
Veera
  • 32,532
  • 36
  • 98
  • 137
24
votes
1 answer

HSSFWorkbook vs XSSFWorkbook vs SXSSFWorkbook - Apache-poi

HSSFWorkbook vs XSSFWorkbook and the advantages/disadvantages of XSSFWorkbook and SXSSFWorkbook?
Sedat Polat
  • 1,631
  • 2
  • 18
  • 28
17
votes
6 answers

POI / Excel : applying formulas in a "relative" way

I'm using Apache's POI to manipulate Excel (.xls) files with Java. I'm trying to create a new cell whom content is the result of a formula as if the user had copied/pasted the formula (what i call the "relative" way, as opposite to "absolute"). To…
Nils
  • 401
  • 2
  • 6
  • 16
17
votes
3 answers

Delete an excel sheet using Apache POI

I have to delete a sheet from the Excel file. Here's my code snippet : FileInputStream fileStream = new FileInputStream(destFile); POIFSFileSystem fsPoi = new POIFSFileSystem(fileStream); HSSFWorkbook workbook = new HSSFWorkbook(fsPoi); int index…
Venkat
  • 2,604
  • 6
  • 26
  • 36
15
votes
1 answer

How to know number of sheets in a workbook?

I'm using hssf api for reading data from xls files. But is there any way to get the exact no. of sheets in a workbook containing stored data?
Supereme
  • 2,379
  • 12
  • 46
  • 67
15
votes
8 answers

Reading string value from Excel with HSSF but it's double

I'm using HSSF-POI for reading excel data. The problem is I have values in a cell that look like a number but really are strings. If I look at the format cell in Excel, it says the type is "text". Still the HSSF Cell thinks it's numeric. How can I…
egaga
  • 21,042
  • 10
  • 46
  • 60
13
votes
1 answer

HSSF POI : How to know if data in cell is of Type Date?

Currently i have my code as bean.setREPO_DATE(row.getCell(16).getDateCellValue()); it works fine if cell is formatted as date in excel. However it also converts some integer or long like 1234 or 5699 to date. I know the reason behind this too.…
Abhishek Singh
  • 10,243
  • 22
  • 74
  • 108
12
votes
2 answers

Java POI: How to find an Excel cell with a string value and get its position (row) to use that position to find another cell

I'm looking for a cell in a spreadsheet that has the string 'Total' and then use the row in which that cell is to find the total value in another cell which is always the same cell/column (the 10th cell in a 0 based index). I have the following…
lv10
  • 1,469
  • 7
  • 25
  • 46
12
votes
6 answers

Convert csv to xls/xlsx using Apache poi?

I need to convert csv to xls/xlsx in my project? How can i do that? Can anyone post me some examples? I want to do it with Apache poi. I also need to create a cell from java side.
v0ld3m0rt
  • 866
  • 3
  • 12
  • 47
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
11
votes
4 answers

Adding border to a merged region in POI XSSF workbook

I'm using apache poi 3.7 and I need to put border to a range of cells or merged region. how can I to apply border to a merged region when the sheet and workbook type is XSSF. In HSSF type I use RegionUtil-/HSSFRegionutil, but if use the first…
Charlessmori
  • 217
  • 2
  • 3
  • 10
9
votes
2 answers

Creating excel sheet from template in Java, new versions of Excel

I found the following code to create a excel sheet from an existing template with formats and add data to it and save it to a new file POIFSFileSystem fs = new POIFSFileSystem( new FileInputStream("template.xls")); HSSFWorkbook wb = new …
cma3982
  • 91
  • 1
  • 1
  • 3
1
2 3
10 11