Skip to content

Commit 5814e29

Browse files
authored
Merge branch 'master' into poi/v3.17-patch14
2 parents 073f02a + b5c14ad commit 5814e29

File tree

128 files changed

+3438
-2065
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+3438
-2065
lines changed

OpenXmlFormats/Wordprocessing/Document.cs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,24 @@ public static CT_Document Parse(XmlNode node, XmlNamespaceManager namespaceManag
7878
if(node == null)
7979
return null;
8080
CT_Document ctObj = new CT_Document();
81+
bool firstBody = true;
8182
foreach(XmlNode childNode in node.ChildNodes)
8283
{
8384
if(childNode.LocalName == "body")
84-
ctObj.body = CT_Body.Parse(childNode, namespaceManager);
85+
{
86+
if(firstBody)
87+
{
88+
ctObj.body = CT_Body.Parse(childNode, namespaceManager);
89+
firstBody = false;
90+
}
91+
else
92+
{
93+
if(ctObj.bodyListField == null)
94+
ctObj.bodyListField = new List<CT_Body> ();
95+
ctObj.bodyListField.Add(CT_Body.Parse(childNode, namespaceManager));
96+
}
97+
}
98+
8599
else if(childNode.LocalName == "background")
86100
ctObj.background = CT_Background.Parse(childNode, namespaceManager);
87101
}
@@ -111,6 +125,13 @@ internal void Write(StreamWriter sw)
111125
sw.Write("mc:Ignorable=\"w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14\">");
112126
if(this.body != null)
113127
this.body.Write(sw, "body");
128+
if(this.bodyList != null)
129+
{
130+
foreach(var b in this.bodyList)
131+
{
132+
b.Write(sw, "body");
133+
}
134+
}
114135
if(this.background != null)
115136
this.background.Write(sw, "background");
116137
sw.Write("</w:document>");
@@ -123,6 +144,8 @@ public CT_Document()
123144
this.bodyField = new CT_Body();
124145
}
125146

147+
private List<CT_Body> bodyListField;
148+
126149
[XmlElement(Order = 0)]
127150
public CT_Body body
128151
{
@@ -136,6 +159,14 @@ public CT_Body body
136159
}
137160
}
138161

162+
public List<CT_Body> bodyList
163+
{
164+
get
165+
{
166+
return bodyListField;
167+
}
168+
}
169+
139170
public void AddNewBody()
140171
{
141172
this.bodyField = new CT_Body();

0 commit comments

Comments
 (0)