Skip to content

Commit

Permalink
only add xml:space="preserve" when the value starts or ends with whit…
Browse files Browse the repository at this point in the history
…espace
  • Loading branch information
tonyqus committed Apr 16, 2024
1 parent 590b7f7 commit 990e862
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions OpenXmlFormats/Wordprocessing/wml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2255,8 +2255,11 @@ public static CT_Text Parse(XmlNode node, XmlNamespaceManager namespaceManager)
internal void Write(StreamWriter sw, string nodeName)
{
sw.Write(string.Format("<w:{0}", nodeName));
this.space = "preserve";
XmlHelper.WriteAttribute(sw, "xml:space", this.space);
if(valueField!=null&&(valueField.StartsWith(" ")||valueField.EndsWith(" ")))
{
this.space = "preserve";
XmlHelper.WriteAttribute(sw, "xml:space", this.space);
}
sw.Write(">");
if (this.valueField != null)
{
Expand Down

0 comments on commit 990e862

Please sign in to comment.