diff --git a/ooxml/OpenXmlFormats/Wordprocessing/Run.cs b/ooxml/OpenXmlFormats/Wordprocessing/Run.cs index 2f9179075..72a420cd1 100644 --- a/ooxml/OpenXmlFormats/Wordprocessing/Run.cs +++ b/ooxml/OpenXmlFormats/Wordprocessing/Run.cs @@ -538,51 +538,51 @@ internal void Write(StreamWriter sw, string nodeName) int i = 0; foreach (object o in this.Items) { - if ((o is CT_Text) && this.ItemsElementName[i] == RunItemsChoiceType.instrText) + if ((o is CT_Text) && this.itemsElementNameField[i] == RunItemsChoiceType.instrText) ((CT_Text)o).Write(sw, "instrText"); else if (o is CT_Object) ((CT_Object)o).Write(sw, "object"); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.pgNum) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.pgNum) sw.Write(""); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.annotationRef) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.annotationRef) sw.Write(""); else if (o is CT_Br) ((CT_Br)o).Write(sw, "br"); else if (o is CT_Markup) ((CT_Markup)o).Write(sw, "w:commentReference"); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.continuationSeparator) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.continuationSeparator) sw.Write(""); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.cr) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.cr) sw.Write(""); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.dayLong) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.dayLong) sw.Write(""); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.dayShort) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.dayShort) sw.Write(""); - else if ((o is CT_Text) && this.ItemsElementName[i] == RunItemsChoiceType.delInstrText) + else if ((o is CT_Text) && this.itemsElementNameField[i] == RunItemsChoiceType.delInstrText) ((CT_Text)o).Write(sw, "delInstrText"); - else if (o is CT_Text && this.ItemsElementName[i] == RunItemsChoiceType.delText) + else if (o is CT_Text && this.itemsElementNameField[i] == RunItemsChoiceType.delText) ((CT_Text)o).Write(sw, "delText"); else if (o is CT_Drawing) ((CT_Drawing)o).Write(sw, "drawing"); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.endnoteRef) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.endnoteRef) sw.Write(""); - else if (o is CT_FtnEdnRef) + else if (o is CT_FtnEdnRef && this.itemsElementNameField[i] == RunItemsChoiceType.endnoteReference) ((CT_FtnEdnRef)o).Write(sw, "endnoteReference"); else if (o is CT_FldChar) ((CT_FldChar)o).Write(sw, "fldChar"); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.footnoteRef) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.footnoteRef) sw.Write(""); - else if (o is CT_FtnEdnRef) + else if (o is CT_FtnEdnRef && this.itemsElementNameField[i] == RunItemsChoiceType.footnoteReference) ((CT_FtnEdnRef)o).Write(sw, "footnoteReference"); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.lastRenderedPageBreak) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.lastRenderedPageBreak) sw.Write(""); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.monthLong) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.monthLong) sw.Write(""); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.monthShort) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.monthShort) sw.Write(""); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.noBreakHyphen) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.noBreakHyphen) sw.Write(""); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.yearLong) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.yearLong) sw.Write(""); else if (o is CT_Picture) ((CT_Picture)o).Write(sw, "pict"); @@ -590,13 +590,13 @@ internal void Write(StreamWriter sw, string nodeName) ((CT_PTab)o).Write(sw, "ptab"); else if (o is CT_Ruby) ((CT_Ruby)o).Write(sw, "ruby"); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.separator) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.separator) sw.Write(""); - else if (o is CT_Empty && this.ItemsElementName[i] == RunItemsChoiceType.softHyphen) + else if (o is CT_Empty && this.itemsElementNameField[i] == RunItemsChoiceType.softHyphen) sw.Write(""); else if (o is CT_Sym) ((CT_Sym)o).Write(sw, "sym"); - else if ((o is CT_Text) && this.ItemsElementName[i] == RunItemsChoiceType.t) + else if ((o is CT_Text) && this.itemsElementNameField[i] == RunItemsChoiceType.t) ((CT_Text)o).Write(sw, "t"); else if (o is CT_Empty) sw.Write(""); @@ -2594,4 +2594,4 @@ public enum ItemsChoiceType6 smartTag, } -} \ No newline at end of file +} diff --git a/ooxml/OpenXmlFormats/Wordprocessing/Table.cs b/ooxml/OpenXmlFormats/Wordprocessing/Table.cs index c08b586fe..bc819e01b 100644 --- a/ooxml/OpenXmlFormats/Wordprocessing/Table.cs +++ b/ooxml/OpenXmlFormats/Wordprocessing/Table.cs @@ -1589,9 +1589,11 @@ internal void Write(StreamWriter sw, string nodeName) XmlHelper.WriteAttribute(sw, "w:bottomFromText", this.bottomFromText); XmlHelper.WriteAttribute(sw, "w:vertAnchor", this.vertAnchor.ToString()); XmlHelper.WriteAttribute(sw, "w:horzAnchor", this.horzAnchor.ToString()); - XmlHelper.WriteAttribute(sw, "w:tblpXSpec", this.tblpXSpec.ToString()); + if(this.tblpXSpecFieldSpecified) + XmlHelper.WriteAttribute(sw, "w:tblpXSpec", this.tblpXSpec.ToString()); XmlHelper.WriteAttribute(sw, "w:tblpX", this.tblpX); - XmlHelper.WriteAttribute(sw, "w:tblpYSpec", this.tblpYSpec.ToString()); + if(this.tblpYSpecFieldSpecified) + XmlHelper.WriteAttribute(sw, "w:tblpYSpec", this.tblpYSpec.ToString()); XmlHelper.WriteAttribute(sw, "w:tblpY", this.tblpY); sw.Write(">"); sw.Write(string.Format("", nodeName)); @@ -1762,6 +1764,7 @@ public ST_XAlign tblpXSpec } set { + tblpXSpecFieldSpecified = true; this.tblpXSpecField = value; } } @@ -1801,6 +1804,7 @@ public ST_YAlign tblpYSpec } set { + tblpYSpecFieldSpecified = true; this.tblpYSpecField = value; } } @@ -6026,4 +6030,4 @@ public enum ItemsChoiceTableRowType } #endregion -} \ No newline at end of file +}