public static CT_Document Parse(XElement node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_Document ctObj = new CT_Document(); foreach (XElement childNode in node.ChildElements()) { if (childNode.Name.LocalName == "body") { ctObj.body = CT_Body.Parse(childNode, namespaceManager); } else if (childNode.Name.LocalName == "background") { ctObj.background = CT_Background.Parse(childNode, namespaceManager); } } return(ctObj); }
public static CT_Body Parse(XElement node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_Body ctObj = new CT_Body(); foreach (XElement childNode in node.ChildElements()) { if (childNode.Name.LocalName == "moveTo") { ctObj.Items.Add(CT_RunTrackChange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.moveTo); } else if (childNode.Name.LocalName == "sectPr") { ctObj.sectPr = CT_SectPr.Parse(childNode, namespaceManager); } else if (childNode.Name.LocalName == "oMathPara") { ctObj.Items.Add(CT_OMathPara.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.oMathPara); } else if (childNode.Name.LocalName == "customXml") { ctObj.Items.Add(CT_CustomXmlBlock.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.customXml); } else if (childNode.Name.LocalName == "oMath") { ctObj.Items.Add(CT_OMath.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.oMath); } else if (childNode.Name.LocalName == "altChunk") { ctObj.Items.Add(CT_AltChunk.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.altChunk); } else if (childNode.Name.LocalName == "bookmarkEnd") { ctObj.Items.Add(CT_MarkupRange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.bookmarkEnd); } else if (childNode.Name.LocalName == "bookmarkStart") { ctObj.Items.Add(CT_Bookmark.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.bookmarkStart); } else if (childNode.Name.LocalName == "commentRangeEnd") { ctObj.Items.Add(CT_MarkupRange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.commentRangeEnd); } else if (childNode.Name.LocalName == "commentRangeStart") { ctObj.Items.Add(CT_MarkupRange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.commentRangeStart); } else if (childNode.Name.LocalName == "customXmlDelRangeEnd") { ctObj.Items.Add(CT_Markup.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.customXmlDelRangeEnd); } else if (childNode.Name.LocalName == "customXmlDelRangeStart") { ctObj.Items.Add(CT_TrackChange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.customXmlDelRangeStart); } else if (childNode.Name.LocalName == "customXmlInsRangeEnd") { ctObj.Items.Add(CT_Markup.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.customXmlInsRangeEnd); } else if (childNode.Name.LocalName == "customXmlInsRangeStart") { ctObj.Items.Add(CT_TrackChange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.customXmlInsRangeStart); } else if (childNode.Name.LocalName == "customXmlMoveFromRangeEnd") { ctObj.Items.Add(CT_Markup.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.customXmlMoveFromRangeEnd); } else if (childNode.Name.LocalName == "customXmlMoveFromRangeStart") { ctObj.Items.Add(CT_TrackChange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.customXmlMoveFromRangeStart); } else if (childNode.Name.LocalName == "customXmlMoveToRangeEnd") { ctObj.Items.Add(CT_Markup.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.customXmlMoveToRangeEnd); } else if (childNode.Name.LocalName == "customXmlMoveToRangeStart") { ctObj.Items.Add(CT_TrackChange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.customXmlMoveToRangeStart); } else if (childNode.Name.LocalName == "del") { ctObj.Items.Add(CT_RunTrackChange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.del); } else if (childNode.Name.LocalName == "ins") { ctObj.Items.Add(CT_RunTrackChange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.ins); } else if (childNode.Name.LocalName == "moveFrom") { ctObj.Items.Add(CT_RunTrackChange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.moveFrom); } else if (childNode.Name.LocalName == "moveFromRangeEnd") { ctObj.Items.Add(CT_MarkupRange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.moveFromRangeEnd); } else if (childNode.Name.LocalName == "moveFromRangeStart") { ctObj.Items.Add(CT_MoveBookmark.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.moveFromRangeStart); } else if (childNode.Name.LocalName == "moveToRangeEnd") { ctObj.Items.Add(CT_MarkupRange.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.moveToRangeEnd); } else if (childNode.Name.LocalName == "moveToRangeStart") { ctObj.Items.Add(CT_MoveBookmark.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.moveToRangeStart); } else if (childNode.Name.LocalName == "p") { ctObj.Items.Add(CT_P.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.p); } else if (childNode.Name.LocalName == "permEnd") { ctObj.Items.Add(CT_Perm.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.permEnd); } else if (childNode.Name.LocalName == "permStart") { ctObj.Items.Add(CT_PermStart.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.permStart); } else if (childNode.Name.LocalName == "proofErr") { ctObj.Items.Add(CT_ProofErr.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.proofErr); } else if (childNode.Name.LocalName == "sdt") { ctObj.Items.Add(CT_SdtBlock.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.sdt); } else if (childNode.Name.LocalName == "tbl") { ctObj.Items.Add(CT_Tbl.Parse(childNode, namespaceManager)); ctObj.ItemsElementName.Add(DocumentBodyItemChoiceType.tbl); } } return(ctObj); }
public void AddNewBody() { this.bodyField = new CT_Body(); }