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

--- Comment #5 from Dirk Dittert <[email protected]> ---
I would like to suggest that this is a general problem with the current style
handling in POI. Here are the XML snippets from before and after the call to
CellUtil.setCellStyleProperty(CellUtil.DATA_FORMAT):

BEFORE: 

<xml-fragment numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006";
xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac";
xmlns:x16r2="http://schemas.microsoft.com/office/spreadsheetml/2015/02/main";
xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision"/>


AFTER:

<xml-fragment numFmtId="1" fontId="0" fillId="4" borderId="4" xfId="0"
applyBorder="true" applyNumberFormat="true" applyFill="true" applyFont="true"
xmlns:main="http://schemas.openxmlformats.org/spreadsheetml/2006/main";>
  <main:alignment horizontal="general" vertical="bottom" indent="0"
textRotation="0" wrapText="false"/>
  <main:protection hidden="false" locked="true"/>
</xml-fragment>

Observations:

- A new fill was created (ID 4) and is now being used for that cell
- New borders were created (ID 4) and are now being used
- Borders, fill and font are applied through this style

This is a major problem for all use cases where you want to enter data into
existing sheets without breaking the optical appearance of the sheet. In
addition to that, it seems to be more limited to what Excel is doing with the
styles: If you set a font for a cell, Excel seems to create a cell style that
only references that particular font and does not touch all other formatting
settings. As a consequence, all underlying formatting will be untouched (e.g.
formatting provided by a data table). POI sets all available formatting
attributes, even if that is not what the user intends to do.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to