Bug 50302 - User defined styles are not correctly applied to cells
Summary: User defined styles are not correctly applied to cells
Status: RESOLVED DUPLICATE of bug 50912
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.7-FINAL
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-19 12:04 UTC by skiping
Modified: 2011-03-11 12:35 UTC (History)
0 users



Attachments
Differences between POI-Excel generated files (23.74 KB, application/zip)
2010-11-19 13:33 UTC, skiping
Details

Note You need to log in before you can comment on or make changes to this bug.
Description skiping 2010-11-19 12:04:20 UTC
Define a user style in a new MSExcel xls file.
Open the file with POI and iterate through the existing styles, 0 to workbook.getNumCellStyles(), using workbook.getCellStyleAt()
Look for the style with the same name that the one you defined, cell.getUserStyleName().
Create a new cell in a sheet and apply it the style, cell.setCellStyle().
Write changes.
If we check the format properties of the new cell with POI we can tell that the style was applied.
If we open the file with OpenOffice Calc we will see the style applied to the cell.
If we open the file with MSExcell we won't see the style applied, we will see a cell with a default style
Comment 1 Nick Burch 2010-11-19 12:09:42 UTC
Assuming you're already tried this with POI 3.7 final

Can you try creating two simple files:
* One where you apply the styling using POI
* One where you emulate what you'd do with POI except within excel
(File 1 won't look right in excel, but file 2 should do)

Now, use org.apache.poi.hssf.dev.BiffViewer to look at what's actually in the files. (You'll want small files to reduce the number of records). Look for style records, and the record(s) for the styled cell, and see how they differ between the two

We'll need this information + the files to be able to narrow down what we're doing wrong in poi
Comment 2 skiping 2010-11-19 13:33:09 UTC
Created attachment 26321 [details]
Differences between POI-Excel generated files
Comment 3 skiping 2010-11-19 13:35:13 UTC
I'm sending you the requested files plus the original file where the style were defined.
The main difference I see is that POI creates a row and a cell, while Excel creates the row, the cell and an extended format: cell record type.
When opening the POI generated file with OOoCalc and saving in a new location the new file writes also the extended format: cell record type and it's viewable in MSExcel.
Comment 4 Yegor Kozlov 2011-03-11 12:35:24 UTC
Fixed in r1080689

Yegor

*** This bug has been marked as a duplicate of bug 50912 ***