You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2015/09/26 18:53:22 UTC

[Bug 58461] New: setDefaultColumnStyle() isn't applied to new cells without explicit style (only XSSF)

https://bz.apache.org/bugzilla/show_bug.cgi?id=58461

            Bug ID: 58461
           Summary: setDefaultColumnStyle() isn't applied to new cells
                    without explicit style (only XSSF)
           Product: POI
           Version: 3.13-dev
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: privat4@hoelle-online.de

Created attachment 33149
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33149&action=edit
Full test case; creates a file first per HSSF, then per XSSF to show the
different Excel behaviour

1. Applying default column style by Sheet.setDefaultColumnStyle
2. Adding new Cell; but don't set an explicit cell style

==> the default column style seems to be not applied if opening the file with
MS Excel 2010.

* Notes:
a) This works if using a HSSFWorkbook.
b) Strange: LibreOffice 4.3.7.2 displays the file as expected.
c) Maybe Bug 51037 deals with the same problem, but the description there is to
imprecise to reproduce it.

* Code snippet:
  Workbook workbook = new XSSFWorkbook();
  Sheet sheet = workbook.createSheet();

  // Set default column style to user formatted time & yellow background
  CellStyle style = workbook.createCellStyle();
  style.setDataFormat(workbook.createDataFormat().getFormat("hh:mm:ss"));
  style.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
  style.setFillPattern(CellStyle.SOLID_FOREGROUND);
  sheet.setDefaultColumnStyle(0, style);

  // Create one cell; cell contains actual date & time ...
  Row row = sheet.createRow(0);
  row.createCell(0).setCellValue(Calendar.getInstance());

* Results when viewing with MS Excel 2010:
The HSSF-file shows all cells - including the filled one - with yellow
background and formatted as time.
In the XSSF-file the filled cell has neither a background color nor a cell
format; the other cells of the column are formatted correctly.

Full test case appended; creates a file per HSSF & XSSF to show the differences
of Excel behaviour.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58461] setDefaultColumnStyle() isn't applied to new cells without explicit style (only XSSF)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58461

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
I'll close this as duplicate of bug 51037 and comment some information from
this bug there to not loose it.

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

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org