Skip to content
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
3 changes: 1 addition & 2 deletions OpenXmlFormats/Drawing/BaseTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2749,8 +2749,7 @@ internal void Write(StreamWriter sw, string nodeName)
XmlHelper.WriteAttribute(sw, "lat", this.lat, true);
XmlHelper.WriteAttribute(sw, "lon", this.lon, true);
XmlHelper.WriteAttribute(sw, "rev", this.rev, true);
sw.Write('>');
sw.WriteEndElement("a", nodeName);
sw.Write("/>");
}

[XmlAttribute]
Expand Down
6 changes: 3 additions & 3 deletions OpenXmlFormats/Drawing/Shape3DStyles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ internal void Write(StreamWriter sw, string nodeName)
XmlHelper.WriteAttribute(sw, "h", this.h, true);
if(this.prst != ST_BevelPresetType.circle)
XmlHelper.WriteAttribute(sw, "prst", this.prst.ToString());
sw.Write('>');
sw.WriteEndElement("a", nodeName);
sw.Write("/>");;
}

public CT_Bevel() {
Expand Down Expand Up @@ -196,7 +195,8 @@ internal void Write(StreamWriter sw, string nodeName)
XmlHelper.WriteAttribute(sw, "z", this.z);
XmlHelper.WriteAttribute(sw, "extrusionH", this.extrusionH);
XmlHelper.WriteAttribute(sw, "contourW", this.contourW);
XmlHelper.WriteAttribute(sw, "prstMaterial", this.prstMaterial.ToString());
if(this.prstMaterialField!= ST_PresetMaterialType.warmMatte)
XmlHelper.WriteAttribute(sw, "prstMaterial", this.prstMaterial.ToString());
sw.Write('>');
if (this.bevelT != null)
this.bevelT.Write(sw, "bevelT");
Expand Down
5 changes: 0 additions & 5 deletions OpenXmlFormats/Drawing/ShapeLineProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ public static CT_LineProperties Parse(XmlNode node, XmlNamespaceManager namespac
ctObj.algnFieldSpecified = node.Attributes["algn"] != null;
if (ctObj.algnFieldSpecified)
ctObj.algn = (ST_PenAlignment)Enum.Parse(typeof(ST_PenAlignment), node.Attributes["algn"].Value);
ctObj.custDash = new CT_DashStopList();
foreach (XmlNode childNode in node.ChildNodes)
{
if (childNode.LocalName == "noFill")
Expand Down Expand Up @@ -604,10 +603,6 @@ internal void Write(StreamWriter sw, string nodeName)
if (this.custDash != null)
{
this.custDash.Write(sw, "custDash");
//foreach (CT_DashStop x in this.custDash)
//{
// x.Write(sw, "custDash");
//}
}
if (this.round != null)
sw.Write("<a:round/>");
Expand Down
1 change: 1 addition & 0 deletions OpenXmlFormats/Drawing/StyleSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ public static CT_OfficeStyleSheet Parse(XmlNode node, XmlNamespaceManager namesp

public void Write(StreamWriter sw)
{
sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>");
sw.Write("<a:theme xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"");
XmlHelper.WriteAttribute(sw, "name", this.name);
sw.Write('>');
Expand Down
6 changes: 3 additions & 3 deletions OpenXmlFormats/Wordprocessing/Numbering.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ public class CT_Lvl

public CT_Lvl()
{
this.rPrField = new CT_RPr();
//this.rPrField = new CT_RPr();
this.pPrField = new CT_PPr();
this.lvlJcField = new CT_Jc();
//this.legacyField = new CT_LvlLegacy();
Expand Down Expand Up @@ -1352,8 +1352,8 @@ internal void Write(StreamWriter sw, string nodeName)
sw.WriteStartW(nodeName);
XmlHelper.WriteAttribute(sw, "w:ilvl", this.ilvl);
XmlHelper.WriteAttribute(sw, "w:tplc", this.tplc);
if(this.tentative!= ST_OnOff.off|| this.tentativeFieldSpecified)
XmlHelper.WriteAttribute(sw, "w:tentative", this.tentative.ToString());
if(Util.XmlHelper.ConvertSTOnOffToBoolean(this.tentative) || this.tentativeFieldSpecified)
XmlHelper.WriteAttribute(sw, "w:tentative", Util.XmlHelper.ConvertSTOnOffToBoolean(this.tentative)?1:0);
sw.Write('>');
if (this.start != null)
this.start.Write(sw, "start");
Expand Down
9 changes: 5 additions & 4 deletions OpenXmlFormats/Wordprocessing/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,10 @@ public static CT_Settings Parse(XmlNode node, XmlNamespaceManager namespaceManag
internal void Write(StreamWriter sw)
{
sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
sw.Write("<w:settings xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" ");
sw.Write("xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:sl=\"http://schemas.openxmlformats.org/schemaLibrary/2006/main\">");
sw.Write("<w:settings mc:Ignorable=\"w14 w15\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" ");
sw.Write("xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:sl=\"http://schemas.openxmlformats.org/schemaLibrary/2006/main\" ");
sw.Write("xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\">");

if (this.writeProtection != null)
this.writeProtection.Write(sw, "writeProtection");
if (this.view != null)
Expand Down Expand Up @@ -2792,8 +2794,7 @@ internal void Write(StreamWriter sw, string nodeName)
sw.WriteStartW(nodeName);
XmlHelper.WriteAttribute(sw, "w:spelling", this.spelling.ToString());
XmlHelper.WriteAttribute(sw, "w:grammar", this.grammar.ToString());
sw.Write('>');
sw.WriteEndW(nodeName);
sw.Write("/>");
}

[XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
Expand Down
14 changes: 14 additions & 0 deletions OpenXmlFormats/XmlHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using NPOI.OpenXmlFormats.Vml.Spreadsheet;
using NPOI.OpenXmlFormats.Vml.Wordprocessing;
using NPOI.OpenXmlFormats.Wordprocessing;
using System;
using System.Collections.Generic;
using System.IO;
Expand All @@ -10,6 +11,19 @@ namespace NPOI.OpenXmlFormats.Util
{
public static class XmlHelper
{
public static bool ConvertSTOnOffToBoolean(ST_OnOff value)
{
if (value == ST_OnOff.True || value == ST_OnOff.on/* || value == ST_OnOff.X_1*/)
{
return true;
}
return false;
}

public static ST_OnOff ConvertBooleanToSTOnOff(bool value)
{
return (value ? ST_OnOff.True : ST_OnOff.False);
}
public static ST_TrueFalseBlank ReadTrueFalseBlank(string attrValue)
{
if (string.IsNullOrEmpty(attrValue))
Expand Down
38 changes: 0 additions & 38 deletions ooxml/XWPF/Model/WMLHelper.cs

This file was deleted.

Loading