/** * Identifies (in order) the parts of the paragraph / * sub-paragraph that correspond to character text * runs, and builds the appropriate runs for these. */ private void BuildRunsInOrderFromXml(ArrayList items) { foreach (object o in items) { if (o is CT_R) { XWPFRun r = new XWPFRun((CT_R)o, this); runs.Add(r); iRuns.Add(r); } if (o is CT_Hyperlink1) { CT_Hyperlink1 link = (CT_Hyperlink1)o; foreach (CT_R r in link.GetRList()) { //runs.Add(new XWPFHyperlinkRun(link, r, this)); XWPFHyperlinkRun hr = new XWPFHyperlinkRun(link, r, this); runs.Add(hr); iRuns.Add(hr); } } if (o is CT_SdtBlock) { XWPFSDT cc = new XWPFSDT((CT_SdtBlock)o, part); iRuns.Add(cc); } if (o is CT_SdtRun) { XWPFSDT cc = new XWPFSDT((CT_SdtRun)o, part); iRuns.Add(cc); } if (o is CT_RunTrackChange) { foreach (CT_R r in ((CT_RunTrackChange)o).GetRList()) { XWPFRun cr = new XWPFRun(r, this); runs.Add(cr); iRuns.Add(cr); } } if (o is CT_SimpleField) { foreach (CT_R r in ((CT_SimpleField)o).GetRList()) { XWPFRun cr = new XWPFRun(r, this); runs.Add(cr); iRuns.Add(cr); } } if (o is CT_SmartTagRun) { // Smart Tags can be nested many times. // This implementation does not preserve the tagging information BuildRunsInOrderFromXml((o as CT_SmartTagRun).Items); } } }