Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of predefined cell styles #274

Closed
JanMarvin opened this issue Jul 16, 2022 · 1 comment
Closed

Handling of predefined cell styles #274

JanMarvin opened this issue Jul 16, 2022 · 1 comment
Labels
help wanted 🙏 Extra attention is needed styles 🎨
Projects
Milestone

Comments

@JanMarvin
Copy link
Owner

JanMarvin commented Jul 16, 2022

We might provide functions to modify the set of predefined cell styles. At first glance they appear to consist of a name and xfId pointing to cellXfs. So all the style values have to be available in styles.xml (fills, border, numfmt etc.). Simply adding a builtin style Heading 1 appears not to be sufficient to style a cell. The builtinIds might indicate the position of the cell style in the drop down menu below.

From my understanding who is pointing at whom:cellStyles -> cellXfs -> cellStylesXfs. Not sure why cellXfs is required, if cellStyleXfs basically does the same (handling borders, fonts, fills and numfmts). (This is not true. From [1]: "The xfId [in cellStyles] is a zero-based index, referencing an xf record in the cellStyleXfs collection.")

<cellStyleXfs count="4">
  <xf numFmtId="0" fontId="0" fillId="0" borderId="0"/>
  <xf numFmtId="0" fontId="2" fillId="0" borderId="1" applyNumberFormat="0" applyFill="0" applyAlignment="0" applyProtection="0"/>
  <xf numFmtId="0" fontId="3" fillId="2" borderId="0" applyNumberFormat="0" applyBorder="0" applyAlignment="0" applyProtection="0"/>
  <xf numFmtId="0" fontId="1" fillId="0" borderId="0" applyFont="0"/>
</cellStyleXfs>
<cellXfs count="4">
  <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>
  <xf numFmtId="0" fontId="3" fillId="2" borderId="0" xfId="2"/>
  <xf numFmtId="0" fontId="2" fillId="0" borderId="1" xfId="1"/>
  <xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="3"/>
</cellXfs>
<cellStyles count="4">
  <cellStyle name="Bad" xfId="2" builtinId="27"/>
  <cellStyle name="Heading 1" xfId="1" builtinId="16"/>
  <cellStyle name="Normal" xfId="0" builtinId="0"/>
  <cellStyle name="teststyle" xfId="3" xr:uid="{A2DCCB99-F391-9F4C-91C8-BEB56C8D5650}"/>
</cellStyles>

Screenshot 2022-07-16 at 07 54 53

I've added help wanted, but it is merely an invitation for others to work on this. It should be straight forward, since we provide almost all that is needed. Maybe missing cellXfs and cellStyles in style_mgr, but everything else should already be in place and would simply require some functions wrapping things nicely. Though it requires some further research and testing.

[1] ECMA-376-1:2016: Office Open XML File Formats — Fundamentals and Markup Language Reference

PS: Maybe for a start I would leave out cellXfsand see if that matters after all.

@JanMarvin JanMarvin added help wanted 🙏 Extra attention is needed styles 🎨 labels Jul 16, 2022
@JanMarvin JanMarvin added this to To Do in styles via automation Jul 16, 2022
@JanMarvin JanMarvin added this to the future milestone Jul 16, 2022
@JanMarvin
Copy link
Owner Author

Related: #518

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted 🙏 Extra attention is needed styles 🎨
Projects
No open projects
styles
To Do
Development

No branches or pull requests

1 participant