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

Do not include xfId in CellStyleXfs XML #1325

Merged
merged 1 commit into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OpenXmlFormats/Spreadsheet/Styles/CT_CellStyleXfs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal void Write(StreamWriter sw, string nodeName)
{
foreach (CT_Xf x in this.xf)
{
x.Write(sw, "xf");
x.Write(sw, "xf", true);
}
}
sw.Write(string.Format("</{0}>", nodeName));
Expand Down
5 changes: 3 additions & 2 deletions OpenXmlFormats/Spreadsheet/Styles/CT_Xf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,15 @@ public static CT_Xf Parse(XmlNode node, XmlNamespaceManager namespaceManager)



internal void Write(StreamWriter sw, string nodeName)
internal void Write(StreamWriter sw, string nodeName, bool writingCellStyle=false)
{
sw.Write(string.Format("<{0}", nodeName));
XmlHelper.WriteAttribute(sw, "numFmtId", this.numFmtId, true);
XmlHelper.WriteAttribute(sw, "fontId", this.fontId, true);
XmlHelper.WriteAttribute(sw, "fillId", this.fillId, true);
XmlHelper.WriteAttribute(sw, "borderId", this.borderId, true);
XmlHelper.WriteAttribute(sw, "xfId", this.xfId, true);
if (!writingCellStyle)
XmlHelper.WriteAttribute(sw, "xfId", this.xfId, true);
XmlHelper.WriteAttribute(sw, "quotePrefix", this.quotePrefix,false);
XmlHelper.WriteAttribute(sw, "pivotButton", this.pivotButton, false);
if(this.applyNumberFormat)
Expand Down
Loading