public static CT_TextParagraph Parse(XElement node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_TextParagraph ctObj = new CT_TextParagraph(); ctObj.r = new List <CT_RegularTextRun>(); ctObj.br = new List <CT_TextLineBreak>(); ctObj.fld = new List <CT_TextField>(); ctObj.items = new List <object>(); foreach (XElement childNode in node.ChildElements()) { if (childNode.Name.LocalName == "pPr") { ctObj.pPr = CT_TextParagraphProperties.Parse(childNode, namespaceManager); ctObj.items.Add(ctObj.pPr); } else if (childNode.Name.LocalName == "endParaRPr") { ctObj.endParaRPr = CT_TextCharacterProperties.Parse(childNode, namespaceManager); ctObj.items.Add(ctObj.endParaRPr); } else if (childNode.Name.LocalName == "r") { CT_RegularTextRun r = CT_RegularTextRun.Parse(childNode, namespaceManager); ctObj.r.Add(r); ctObj.items.Add(r); } else if (childNode.Name.LocalName == "br") { CT_TextLineBreak br = CT_TextLineBreak.Parse(childNode, namespaceManager); ctObj.br.Add(br); ctObj.items.Add(br); } else if (childNode.Name.LocalName == "fld") { CT_TextField fld = CT_TextField.Parse(childNode, namespaceManager); ctObj.fld.Add(fld); ctObj.items.Add(fld); } } return(ctObj); }
public static CT_TextField Parse(XElement node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_TextField ctObj = new CT_TextField(); ctObj.t = XmlHelper.ReadString(node.Attribute("t")); ctObj.id = XmlHelper.ReadString(node.Attribute("id")); ctObj.type = XmlHelper.ReadString(node.Attribute("type")); foreach (XElement childNode in node.ChildElements()) { if (childNode.Name.LocalName == "rPr") { ctObj.rPr = CT_TextCharacterProperties.Parse(childNode, namespaceManager); } else if (childNode.Name.LocalName == "pPr") { ctObj.pPr = CT_TextParagraphProperties.Parse(childNode, namespaceManager); } } return(ctObj); }