public static string GetBackIterators(Paragraph paragraph) { ParagraphIterator iter = new ParagraphIterator(paragraph.Elements); iter = iter.GetLastLeaf(); string retString = ""; while (iter != null) { retString += "[" + iter.Current.GetType().Name + ":]"; if (iter.Current is Text) retString += ((Text)iter.Current).Content; iter = iter.GetPreviousLeaf(); } return retString; }
XUnit GetPreviousBlankWidth(ParagraphIterator beforeIter) { XUnit width = 0; ParagraphIterator savedIter = this.currentLeaf; this.currentLeaf = beforeIter.GetPreviousLeaf(); while (this.currentLeaf != null) { if (this.currentLeaf.Current is BookmarkField) this.currentLeaf = this.currentLeaf.GetPreviousLeaf(); else if (IsBlank(this.currentLeaf.Current)) { if (!IgnoreBlank()) width = CurrentWordDistance; break; } else break; } this.currentLeaf = savedIter; return width; }