public static CT_TextBody Parse(XmlNode node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_TextBody ctObj = new CT_TextBody(); ctObj.p = new List <CT_TextParagraph>(); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "bodyPr") { ctObj.bodyPr = CT_TextBodyProperties.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "lstStyle") { ctObj.lstStyle = CT_TextListStyle.Parse(childNode, namespaceManager); } else if (childNode.LocalName == "p") { ctObj.p.Add(CT_TextParagraph.Parse(childNode, namespaceManager)); } } return(ctObj); }
public CT_TextParagraph AddNewP() { if (this.pField == null) { pField = new List <CT_TextParagraph>(); } CT_TextParagraph tp = new CT_TextParagraph(); pField.Add(tp); return(tp); }
public static CT_TextParagraph Parse(XmlNode 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 (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "pPr") { ctObj.pPr = CT_TextParagraphProperties.Parse(childNode, namespaceManager); ctObj.items.Add(ctObj.pPr); } else if (childNode.LocalName == "endParaRPr") { ctObj.endParaRPr = CT_TextCharacterProperties.Parse(childNode, namespaceManager); ctObj.items.Add(ctObj.endParaRPr); } else if (childNode.LocalName == "r") { CT_RegularTextRun r = CT_RegularTextRun.Parse(childNode, namespaceManager); ctObj.r.Add(r); ctObj.items.Add(r); } else if (childNode.LocalName == "br") { CT_TextLineBreak br = CT_TextLineBreak.Parse(childNode, namespaceManager); ctObj.br.Add(br); ctObj.items.Add(br); } else if (childNode.LocalName == "fld") { CT_TextField fld = CT_TextField.Parse(childNode, namespaceManager); ctObj.fld.Add(fld); ctObj.items.Add(fld); } } return(ctObj); }
public void SetPArray(CT_TextParagraph[] array) { pField = new List<CT_TextParagraph>(array); }
public CT_TextParagraph AddNewP() { if (this.pField == null) pField = new List<CT_TextParagraph>(); CT_TextParagraph tp = new CT_TextParagraph(); pField.Add(tp); return tp; }
public void SetText(XSSFRichTextString str) { XSSFWorkbook wb = (XSSFWorkbook)GetDrawing().GetParent().GetParent(); str.SetStylesTableReference(wb.GetStylesSource()); CT_TextParagraph p = new CT_TextParagraph(); if (str.NumFormattingRuns == 0) { CT_RegularTextRun r = p.AddNewR(); CT_TextCharacterProperties rPr = r.AddNewRPr(); rPr.lang = ("en-US"); rPr.sz = (1100); r.t = str.String; } else { for (int i = 0; i < str.GetCTRst().sizeOfRArray(); i++) { CT_RElt lt = str.GetCTRst().GetRArray(i); CT_RPrElt ltPr = lt.rPr; if (ltPr == null) ltPr = lt.AddNewRPr(); CT_RegularTextRun r = p.AddNewR(); CT_TextCharacterProperties rPr = r.AddNewRPr(); rPr.lang = ("en-US"); ApplyAttributes(ltPr, rPr); r.t = (lt.t); } } ctShape.txBody.SetPArray(new CT_TextParagraph[] { p }); }
public static CT_TextParagraph Parse(XmlNode 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>(); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "pPr") ctObj.pPr = CT_TextParagraphProperties.Parse(childNode, namespaceManager); else if (childNode.LocalName == "endParaRPr") ctObj.endParaRPr = CT_TextCharacterProperties.Parse(childNode, namespaceManager); else if (childNode.LocalName == "r") ctObj.r.Add(CT_RegularTextRun.Parse(childNode, namespaceManager)); else if (childNode.LocalName == "br") ctObj.br.Add(CT_TextLineBreak.Parse(childNode, namespaceManager)); else if (childNode.LocalName == "fld") ctObj.fld.Add(CT_TextField.Parse(childNode, namespaceManager)); } return ctObj; }