private void method_4(ParagraphBase A_0) { if (A_0 is TextRange) { Paragraph paragraph = A_0.method_28(); foreach (Match match in regex_0.Matches(((TextRange)A_0).Text)) { if (((Class567.smethod_16(match.Groups[2].Value) || Class567.smethod_16(match.Groups[1].Value)) || Class567.smethod_16(match.Groups[3].Value)) && !this.method_6(A_0, match.Index)) { if (Class567.smethod_16(match.Groups[2].Value)) { this.class974_0.method_8(paragraph, false, true); } if (Class567.smethod_16(match.Groups[1].Value)) { this.class974_0.method_8(paragraph, true, false); } if (Class567.smethod_16(match.Groups[3].Value)) { this.class974_0.method_8(paragraph, false, false); } } if (Class567.smethod_16(match.Groups[4].Value) && !this.class422_0.method_67()) { this.class974_0.method_2(A_0); } } } }
private CharacterFormat method_1(ParagraphBase A_0) { if (A_0 == null) { return(null); } CharacterFormat characterFormat = null; ITextRange nextSibling = this.bookmark_0.BookmarkStart.NextSibling as ITextRange; if (nextSibling != null) { return(nextSibling.CharacterFormat); } ITextRange previousSibling = this.bookmark_0.BookmarkStart.PreviousSibling as ITextRange; ITextRange range2 = this.bookmark_0.BookmarkEnd.NextSibling as ITextRange; nextSibling = this.InsertParagraphItem(ParagraphItemType.TextRange) as ITextRange; if (previousSibling != null) { return(previousSibling.CharacterFormat); } if (range2 != null) { characterFormat = range2.CharacterFormat; } return(characterFormat); }
private void method_4(BodyRegion A_0) { ParagraphBase bookmarkStart = this.CurrentBookmark.BookmarkStart; if (bookmarkStart != null) { bool flag = false; int num = bookmarkStart.method_5(); Paragraph ownerParagraph = bookmarkStart.OwnerParagraph; Paragraph paragraph2 = new Paragraph(ownerParagraph.Document); if (bookmarkStart.NextSibling == null) { flag = true; } if ((A_0 is Paragraph) && (bookmarkStart.NextSibling == null)) { paragraph2 = A_0 as Paragraph; flag = false; } num++; TextBodyPart.smethod_0(ownerParagraph, num, paragraph2); int index = paragraph2.method_5(); ownerParagraph.OwnerTextBody.Items.Insert(index, A_0); if (((flag && (paragraph2.Text == "")) && ((bookmarkStart.OwnerBase != null) && (bookmarkStart.OwnerBase.OwnerBase != null))) && (bookmarkStart.OwnerBase.OwnerBase is Body)) { int num3 = (bookmarkStart.OwnerBase.OwnerBase as Body).Paragraphs.IndexOf(paragraph2); (bookmarkStart.OwnerBase.OwnerBase as Body).Paragraphs.RemoveAt(num3); } } }
private void method_5(ParagraphBase A_0) { Paragraph paragraph = A_0.method_28(); Section section = paragraph.method_49().Clone(); Paragraph paragraph2 = (Paragraph)paragraph.Clone(); section.Body.Paragraphs.Add(paragraph2); if (A_0 is TextRange) { foreach (Match match in regex_0.Matches(((TextRange)A_0).Text)) { string str = match.Groups[4].Value; if (((Class567.smethod_16(match.Groups[2].Value) || Class567.smethod_16(match.Groups[1].Value)) || Class567.smethod_16(match.Groups[3].Value)) && !this.method_6(A_0, match.Index)) { this.class569_0.method_19(paragraph); } if (Class567.smethod_16(str)) { ParagraphBase entity = (ParagraphBase)A_0.Clone(); paragraph2.ChildObjects.Add(entity); if (entity is TextRange) { ((TextRange)entity).Text = str; } this.method_0(entity); } } } }
private void button1_Click(object sender, EventArgs e) { Document document = new Document(); document.LoadFromFile(@"..\..\..\..\..\..\Data\Footnote.docx"); Section section = document.Sections[0]; //traverse paragraphs in the section and find the footnote foreach (Paragraph para in section.Paragraphs) { int index = -1; for (int i = 0, cnt = para.ChildObjects.Count; i < cnt; i++) { ParagraphBase pBase = para.ChildObjects[i] as ParagraphBase; if (pBase is Footnote) { index = i; break; } } if (index > -1) { //remove the footnote para.ChildObjects.RemoveAt(index); } } document.SaveToFile("RemoveFootnote.docx", FileFormat.Docx); //view the Word file. WordDocViewer("RemoveFootnote.docx"); }
public void imethod_1(Class196 A_0, Class375 A_1) { if (((this.interface21_0 is Field) && (this.method_0() != null)) && (this.method_0() != string.Empty)) { string text = (this.interface21_0 as Field).Text; (this.interface21_0 as Field).Text = this.method_0(); this.interface21_0.imethod_1(A_0, A_1); (this.interface21_0 as Field).Text = text; } else if (((A_1.method_73() as Class542).method_2() as TextRange).PreviousSibling is FieldMark) { string str = ((A_1.method_73() as Class542).method_2() as TextRange).Text; ParagraphBase previousSibling = ((A_1.method_73() as Class542).method_2() as TextRange).PreviousSibling as ParagraphBase; if (((previousSibling.PreviousSibling != null) && (previousSibling.PreviousSibling is Field)) && ((previousSibling.PreviousSibling as Field).Type == FieldType.FieldNumPages)) { this.interface21_0.imethod_7(A_0, A_1, str); } else { this.interface21_0.imethod_7(A_0, A_1, this.method_0()); } } else { this.interface21_0.imethod_7(A_0, A_1, this.method_0()); } }
private void method_3() { int num = 0; if (this.field_0.OwnerParagraph != null) { bool flag = false; Paragraph ownerParagraph = this.field_0.OwnerParagraph; int num2 = this.method_7(ref ownerParagraph); if (num2 != -1) { for (ParagraphBase base2 = ownerParagraph.Items[num2]; !(base2 is FieldMark); base2 = ownerParagraph.Items[num2]) { base2 = ownerParagraph.Items[num2]; if ((base2 is TextRange) && !(base2 is Spire.Doc.Fields.Field)) { this.string_3 = this.string_3 + (base2 as TextRange).Text; } else if (base2 is ShapeObject) { this.shapeObject_0 = base2 as ShapeObject; } else if ((base2 is Break) && ((base2 as Break).BreakType == BreakType.LineBreak)) { this.string_3 = this.string_3 + BookmarkStart.b("ⴥ", num); } num2++; if (ownerParagraph.Items.Count <= num2) { if ((ownerParagraph.NextSibling == null) || !(ownerParagraph.NextSibling is Paragraph)) { break; } if (!flag) { flag = true; this.string_4 = this.string_3; } this.string_3 = this.string_3 + BookmarkStart.b("⬥∧", num); if (ownerParagraph.LastItem is Spire.Doc.Fields.Field) { num2 = 1; } else { num2 = 0; } for (ownerParagraph = ownerParagraph.NextSibling as Paragraph; ownerParagraph.ChildObjects.Count == 0; ownerParagraph = ownerParagraph.NextSibling as Paragraph) { if ((ownerParagraph.NextSibling == null) || !(ownerParagraph.NextSibling is Paragraph)) { break; } this.string_3 = this.string_3 + BookmarkStart.b("⬥∧", num); } } } } } }
internal void method_23(ParagraphBase A_0, int A_1, string A_2) { int num = 4; this.stringBuilder_0.Remove(A_0.StartPos, A_1); this.stringBuilder_0.Insert(A_0.StartPos, A_2); int num2 = A_2.Length - A_1; int index = this.paragraphItemCollection_0.IndexOf(A_0); if (index < 0) { throw new InvalidOperationException(BookmarkStart.b("娩攫娭唯弱ᐳ帵夷䰹夻倽朿㙁摃⁅❇㽉≋⩍灏㭑㩓癕⡗㭙⹛㽝ݟၡգᙥg䩩իᩭᕯάݳ", num)); } int num4 = index + 1; int count = this.paragraphItemCollection_0.Count; while (num4 < count) { ParagraphBase base2 = this.paragraphItemCollection_0[num4]; if (base2 != null) { base2.StartPos += num2; } num4++; } }
protected override void OnInsertComplete(int index, DocumentObject entity) { base.OnInsertComplete(index, entity); if ((base.Joined && (entity.Owner != null)) && (this.OwnerParagraph != null)) { ParagraphBase base3 = (ParagraphBase)entity; int itemPos = 0; if (index > 0) { itemPos = this[index - 1].EndPos; } base3.Attach(this.OwnerParagraph, itemPos); } else if (base.Joined && (entity.Owner is SDTInlineContent)) { ParagraphBase base2 = (ParagraphBase)entity; int endPos = 0; if (index > 0) { endPos = this[index - 1].EndPos; } base2.Attach(entity.Owner as SDTInlineContent, endPos); } else if (base.Joined && (entity.Owner is MergeField)) { (entity as ParagraphBase).CharacterFormat.ApplyBase((entity.Owner as MergeField).CharacterFormat.BaseFormat); } }
public void PasteAfter(ParagraphBase paragraphItem) { BodyRegion owner = paragraphItem.Owner as BodyRegion; int itemIndex = owner.method_5(); int num2 = paragraphItem.method_5(); this.PasteAt(owner.OwnerTextBody, itemIndex, num2 + 1); }
public void Copy(ParagraphBase pItem, bool clone) { if (clone) { pItem = (ParagraphBase)pItem.Clone(); } this.method_4(pItem.Document); this.body_0.AddParagraph().Items.Add(pItem); }
private static void smethod_7(ParagraphItemCollection A_0, int A_1, int A_2) { int num = A_1; int count = A_0.Count; while (num < count) { ParagraphBase base2 = A_0[num]; base2.StartPos += A_2; num++; } }
internal void method_25(ParagraphBase A_0) { int num = 0x11; string text = ((TextRange)A_0).Text; int num2 = 0; StringBuilder builder = new StringBuilder(); bool flag = false; string str2 = null; while (num2 < text.Length) { char ch = text[num2]; if (ch == '&') { if (flag) { this.class400_0.method_15(builder.ToString()); this.class400_0.method_5(); builder.Length = 0; flag = false; str2 = null; } this.class400_0.method_10(BookmarkStart.b("娶吸场ܼ刾⁀⽂ⱄ⁆❈♊ⱌ㵎㩐", num)); num2++; } else { string str3 = this.method_27(text, num2); if (str3 != null) { this.class400_0.method_15(builder.ToString()); this.class400_0.method_6(str3); builder.Length = 0; flag = false; } str2 = this.method_26(text, num2); if (str2 != null) { this.class400_0.method_4(str2); flag = true; } builder.Append(text[num2]); num2++; } } if (!flag) { this.class400_0.method_4(str2); } this.class400_0.method_15(builder.ToString()); this.class400_0.method_5(); }
internal void method_2(ParagraphBase A_0) { int num = 13; string str = null; if ((A_0.GetType().Name != BookmarkStart.b("笲䰴䜶尸䤺儼嘾⽀⡂", 13)) || !this.class422_0.method_101()) { str = smethod_2(A_0); } this.method_11(this.method_27(), BookmarkStart.b("䜲倴伶䴸", num), str); this.class526_0.method_0(A_0, A_0.CharacterFormat); this.class422_0.method_18().method_6(BookmarkStart.b("䀲䄴丶唸帺ܼ䰾㕀㩂⥄≆", num)); }
private static void smethod_2(Class581 A_0, CharacterFormat A_1) { if ((A_0.imethod_1().method_52().Count <= 0) || (A_0.imethod_1().method_53() != FieldCharType.Seperate)) { bool flag = A_0.imethod_1().method_53() == FieldCharType.Begin; fieldCharType_0 = FieldCharType.Seperate; A_0.imethod_1().method_52().Push(fieldCharType_0); ParagraphBase lastChild = A_0.method_13().LastChild as ParagraphBase; if (A_0.imethod_1().method_57() != null) { lastChild = A_0.imethod_1().method_57(); } else if (flag) { lastChild = new Field(A_0.Interface50.imethod_0()); A_0.imethod_1().method_54().Push(lastChild as Field); A_0.method_9(lastChild); } if (((lastChild is Field) || (lastChild is TextRange)) && !(lastChild is MergeField)) { if ((lastChild is Field) ? ((lastChild as Field).Type == FieldType.FieldTOC) : false) { if (lastChild.Owner == null) { return; } (lastChild as Field).ParseFieldCode((lastChild as Field).Code); TableOfContent content = new TableOfContent(A_0.Interface50.imethod_0(), A_0.imethod_1().method_57().FormattingString); A_0.Interface50.imethod_0().TOC = content; content.FormattingString = A_0.imethod_1().method_57().FormattingString; A_0.method_13().ChildObjects.Remove(lastChild); A_0.method_9(content); if (A_0.method_13() is Paragraph) { (A_0.method_13() as Paragraph).IsTOCPara = true; } else { (A_0.method_13() as ParagraphBase).OwnerParagraph.IsTOCPara = true; } lastChild = content.TOCField; } FieldMark mark = new FieldMark(A_0.Interface50.imethod_0(), A_1, FieldMarkType.FieldSeparator); A_0.method_9(mark); if (lastChild is Field) { (lastChild as Field).Separator = mark; } } } }
private bool method_6(ParagraphBase A_0, int A_1) { if (!(A_0 is TextRange)) { return(false); } string text = ((TextRange)A_0).Text; if (((A_1 != 0) || (A_0.PreviousSibling != null)) && !(A_0.NextSibling is FieldMark)) { return((A_1 == (text.Length - 1)) && (A_0.NextSibling == null)); } return(true); }
internal void method_22(ParagraphItemCollection A_0) { int num = 0; int count = base.Count; while (num < count) { ParagraphBase base2 = (ParagraphBase)this[num].Clone(); if (base2 != null) { base2.method_0(A_0.Owner); A_0.method_25(base2); } num++; } }
private VisitorAction method_9(ParagraphBase A_0) { if (this.class1136_0 != null) { if (this.method_23() == OpenDocumentWritingStage.MathML) { this.class1136_0.method_25(A_0); } return(VisitorAction.Continue); } if (A_0.ParentObject.DocumentObjectType == DocumentObjectType.OfficeMath) { return(VisitorAction.Continue); } return(this.class691_0.method_3(A_0)); }
internal TextSelection(SDTInlineContent A_0, int A_1, int A_2) { this.list_0 = new List <TextRange>(); this.sdtinlineContent_0 = A_0; this.paragraph_0 = A_0.OwnerParagraph; if (A_0.Items.Count != 0) { TextRange range; this.int_2 = Class191.smethod_4(A_0, A_1 + 1, out range); if (range != null) { this.int_0 = A_1 - range.StartPos; this.textRange_0 = range; this.int_3 = Class191.smethod_4(A_0, A_2, out range); if ((this.int_3 >= this.int_2) && (range != null)) { this.int_1 = A_2 - range.StartPos; } else { for (int j = A_0.Items.Count; j > 0; j--) { ParagraphBase base2 = A_0[j - 1]; if (base2 is TextRange) { range = base2 as TextRange; break; } } this.int_1 = (A_2 - range.StartPos) - 1; } this.textRange_1 = range; if (this.int_1 == range.TextLength) { this.int_1 = -1; } for (int i = this.int_2; i <= this.int_3; i++) { range = A_0.Items[i] as TextRange; if (range != null) { this.list_0.Add(range); } } } } }
internal VisitorAction method_3(ParagraphBase A_0) { string text = ((TextRange)A_0).Text; if ((text != Class816.string_15) && (text != Class816.string_14)) { Paragraph paragraph = A_0.method_28(); if (paragraph == null) { return(VisitorAction.Continue); } bool flag = ((text.IndexOf(Class816.string_26) != -1) || (text.IndexOf(Class816.string_25) != -1)) || (text.IndexOf(Class816.string_27) != -1); if (this.method_11(text, flag)) { return(VisitorAction.Continue); } switch (this.class422_0.method_23()) { case OpenDocumentWritingStage.ContentAutomaticStyles: case OpenDocumentWritingStage.StylesAutomaticStyles: if ((!this.class422_0.method_67() || flag) && (!Class569.smethod_7(paragraph) && (!this.class422_0.method_103() || !this.class422_0.method_101()))) { if (flag) { this.method_4(A_0); } else { this.class974_0.method_2(A_0); } } break; case OpenDocumentWritingStage.ContentBody: case OpenDocumentWritingStage.StylesMasterPage: if (!flag) { this.method_0(A_0); break; } this.method_5(A_0); break; } } return(VisitorAction.Continue); }
public TextSelection(Paragraph para, int startCharPos, int endCharPos) { this.list_0 = new List <TextRange>(); this.paragraph_0 = para; if (this.paragraph_0.Items.Count != 0) { TextRange range; this.int_2 = Class191.smethod_2(this.paragraph_0, startCharPos + 1, out range); if (range != null) { this.int_0 = startCharPos - range.StartPos; this.textRange_0 = range; this.int_3 = Class191.smethod_2(this.paragraph_0, endCharPos, out range); if ((this.int_3 >= this.int_2) && (range != null)) { this.int_1 = endCharPos - range.StartPos; } else { for (int j = para.Items.Count; j > 0; j--) { ParagraphBase base2 = para[j - 1]; if (base2 is TextRange) { range = base2 as TextRange; break; } } this.int_1 = (endCharPos - range.StartPos) - 1; } this.textRange_1 = range; if (this.int_1 == range.TextLength) { this.int_1 = -1; } for (int i = this.int_2; i <= this.int_3; i++) { range = this.paragraph_0.Items[i] as TextRange; if (range != null) { this.list_0.Add(range); } } } } }
private void method_5(Paragraph A_0, ParagraphBase A_1) { if ((A_0 == null) || (A_1 == null)) { return; } DocumentObject obj2 = A_0.ChildObjects.method_20(DocumentObjectType.TextRange); if (A_1 is DocPicture) { using (IEnumerator enumerator = A_0.ChildObjects.GetEnumerator()) { ParagraphBase current; while (enumerator.MoveNext()) { current = (ParagraphBase)enumerator.Current; if (current is DocPicture) { goto Label_004F; } } goto Label_00DB; Label_004F: (current as DocPicture).method_88((A_1 as DocPicture).ImageBytes, true); goto Label_00DB; } } if ((obj2 is TextRange) && (A_1 is TextRange)) { TextRange entity = obj2.Clone() as TextRange; entity.Text = (A_1 as TextRange).Text; A_0.ChildObjects.Clear(); A_0.ChildObjects.Add(entity); } else { A_0.ChildObjects.Clear(); A_0.ChildObjects.Add(A_1); } Label_00DB: obj2 = null; }
internal static char smethod_4(DocumentObject A_0) { if ((A_0 != null) && (A_0 is Paragraph)) { Paragraph paragraph = A_0 as Paragraph; if (paragraph.ChildObjects.Count > 0) { ParagraphBase base2 = (ParagraphBase)paragraph.ChildObjects[paragraph.ChildObjects.Count - 1]; if ((base2 != null) && (base2 is TextRange)) { string text = ((TextRange)base2).Text; if (Class567.smethod_16(text) && (text.Length > 1)) { return(text[text.Length - 1]); } } } } return('\0'); }
internal void method_0(ParagraphBase A_0) { if (!this.class422_0.method_67()) { bool flag; if (!(flag = Class569.smethod_7(A_0.OwnerParagraph)) && (!this.class422_0.method_103() || !this.class422_0.method_101())) { this.method_1(); } if (!(A_0 as TextRange).SkipDocxItem && (A_0 is TextRange)) { string str = smethod_0(((TextRange)A_0).Text); this.method_7(str); if (!flag && (!this.class422_0.method_103() || !this.class422_0.method_101())) { this.method_2(); } this.class422_0.method_96(false); } } }
private int method_7(ref Paragraph A_0) { DocumentObject obj2 = this.field_0; int num = this.method_8(obj2); if (num >= 0) { int num2 = this.field_0.method_5() + num; if ((num2 == (A_0.ChildObjects.Count - 1)) && ((A_0.ChildObjects[num2] is Spire.Doc.Fields.Field) || (A_0.ChildObjects[num2] is FieldMark))) { while (A_0.NextSibling != null) { if (!(A_0.NextSibling is Paragraph)) { break; } if (A_0.ChildObjects[num2] is FieldMark) { num2 = 0; A_0 = A_0.NextSibling as Paragraph; } else { A_0 = A_0.NextSibling as Paragraph; num2 = this.method_8(A_0.ChildObjects[0]); } if (num2 >= 0) { break; } } } ParagraphBase base2 = A_0.Items[num2]; if ((base2 is TextRange) || (base2 is ShapeObject)) { return(num2); } } return(-1); }
private static void smethod_5(ParagraphItemCollection A_0, int A_1, int A_2, out ParagraphBase A_3) { int startPos = 0; A_3 = null; for (int i = A_2; i < A_0.Count; i++) { A_3 = A_0[i]; startPos = A_3.StartPos; if (A_3 is TextRange) { TextRange range = A_3 as TextRange; startPos = range.StartPos + range.TextLength; } if (startPos >= A_1) { return; } A_0.method_23(i); i--; } }
internal static void smethod_0(Class581 A_0) { Class394 class2 = A_0.imethod_1(); A_0.Interface50.imethod_0(); Field field = smethod_1(class2.method_12(BookmarkStart.b("嬱娳䔵䰷䠹", 12), ""), A_0.Interface50.imethod_0()); field.ParseFieldCode(field.Code); FieldType type = field.Type; A_0.method_9(field); class2.method_54().Push(field); if (!(field is MergeField)) { FieldMark mark = new FieldMark(A_0.Interface50.imethod_0(), FieldMarkType.FieldSeparator); field.Separator = mark; A_0.method_9(mark); } Class464.smethod_0(A_0); if (!(field is MergeField)) { ParagraphBase lastChild = A_0.method_13().LastChild as ParagraphBase; if ((lastChild != null) && !lastChild.CharacterFormat.HasDeleteRevision) { CharacterFormat format1 = (CharacterFormat)lastChild.CharacterFormat.Clone(); } else { new CharacterFormat(A_0.Interface50.imethod_0()); } FieldMark mark2 = new FieldMark(A_0.Interface50.imethod_0(), FieldMarkType.FieldEnd); A_0.method_9(mark2); field.End = mark2; } if ((class2.method_54().Count > 0) && (class2.method_54().Peek() == field)) { class2.method_54().Pop(); } }
internal void method_25(ParagraphBase A_0) { base.InnerList.Add(A_0); if ((base.Document != null) && !base.Document.bool_3) { if ((A_0 is Field) && ((A_0 as Field).End != null)) { base.Document.ClonedFields.Push(A_0 as Field); } else if ((A_0 is FieldMark) && (base.Document.ClonedFields.Count > 0)) { Field field = base.Document.ClonedFields.Peek(); if ((A_0 as FieldMark).Type == FieldMarkType.FieldSeparator) { field.Separator = A_0 as FieldMark; } else { base.Document.ClonedFields.Pop().End = A_0 as FieldMark; } } } }
private void method_12(DocumentObject A_0, DocumentObject A_1, DocumentObject A_2, bool A_3) { if (A_3) { if (A_2 == A_0.LastChild) { A_0.method_13(A_1); } else { A_0.method_17(A_1, A_2); } } else { A_0.method_18(A_1, A_2); } ParagraphBase base2 = A_1 as ParagraphBase; if (base2 != null) { CharacterFormat characterFormat = base2.CharacterFormat; if ((this.stack_0 != null) && (this.stack_0.Count > 0)) { if (this.stack_0.Peek().method_4() == EditRevisionType.Deletion) { characterFormat.IsDeleteRevision = true; characterFormat.DeleteRevision = this.stack_0.Peek(); } else { characterFormat.IsInsertRevision = true; characterFormat.InsertRevision = this.stack_0.Peek(); } } } }
internal static int smethod_3(Paragraph A_0, int A_1, out ParagraphBase A_2) { A_2 = null; int num = 0; int num2 = 0; int count = A_0.Items.Count; while (num2 < count) { A_2 = A_0[num2] as TextRange; if ((A_2 != null) && ((A_2.StartPos + (A_2 as TextRange).TextLength) >= A_1)) { return(num2); } if ((A_0[num2] is Break) && (((A_0[num2] as Break).StartPos + 1) >= A_1)) { num = num2; A_2 = A_0[num2]; return(num); } num2++; } return(num); }