Example #1
0
        public IParagraphBase InsertParagraphItem(ParagraphItemType itemType)
        {
            IParagraphBase entity = this.document_0.CreateParagraphItem(itemType);

            this.iparagraph_0.Items.Insert(this.int_1, entity);
            return(entity);
        }
Example #2
0
        public void MoveToBookmark(string bookmarkName, bool isStart, bool isAfter)
        {
            int num = 0;

            this.bool_0 = isStart;
            this.bool_1 = isAfter;
            string name = bookmarkName.Replace('-', '_');

            if (this.document_0 == null)
            {
                throw new InvalidOperationException(BookmarkStart.b("缥䜧弩ఫ䴭儯就ᐳ堵圷丹᰻䬽㌿❁摃Ʌ❇⥉㥋⍍㕏㱑⁓ᡕ㥗ⱙ㕛㥝şᙡୣᑥ䡧ᵩիᩭᡯᵱųɵ塷፹ቻ᝽늑킓秊ﮗﮝ캟횡蒣횥\udaa7\uc5a9\udcab\ucbad슯욱춳", num));
            }
            this.bookmark_0 = this.document_0.Bookmarks.FindByName(name);
            if (this.bookmark_0 == null)
            {
                throw new ArgumentException(BookmarkStart.b("甥堧伩伫䜭嘯嬱儳刵ᠷ堹医儽⬿⽁╃㑅⍇橉≋⅍⑏牑㉓㥕ⵗ㑙㡛", num));
            }
            IParagraphBase entity = (isStart || (this.bookmark_0.BookmarkEnd == null)) ? ((IParagraphBase)this.bookmark_0.BookmarkStart) : ((IParagraphBase)this.bookmark_0.BookmarkEnd);

            this.iparagraph_0 = entity.OwnerParagraph;
            if (isAfter)
            {
                this.int_1 = this.iparagraph_0.Items.IndexOf(entity) + 1;
            }
            else
            {
                this.int_1 = this.iparagraph_0.Items.IndexOf(entity);
            }
        }
Example #3
0
 public void AddItem(IParagraphBase paraItem)
 {
     if ((base.OwnerParagraph != null) && ((this.paragraphItemCollection_1 == null) || !this.paragraphItemCollection_1.Contains(paraItem)))
     {
         Paragraph ownerParagraph = base.OwnerParagraph;
         int       index          = base.method_5();
         if (this.m_format.CommentId == -1)
         {
             int num4 = Class323.smethod_0().Next();
             this.m_format.CommentId = num4;
             CommentMark entity = new CommentMark(base.m_doc, num4)
             {
                 Type = CommentMarkType.CommentStart
             };
             CommentMark mark3 = new CommentMark(base.m_doc, num4)
             {
                 Type = CommentMarkType.CommentEnd
             };
             ownerParagraph.Items.Insert(index, mark3);
             ownerParagraph.Items.Insert(index, entity);
         }
         index = base.method_5();
         if (ownerParagraph.Items[index - 1] is CommentMark)
         {
             int commentId = this.m_format.CommentId;
             if (paraItem.OwnerParagraph == null)
             {
                 this.method_32(ownerParagraph, index - 1, paraItem);
             }
             else if ((ownerParagraph.Items.Count > (index + 1)) && (paraItem == ownerParagraph.Items[index + 1]))
             {
                 ownerParagraph.Items.RemoveAt(index + 1);
                 this.method_32(ownerParagraph, index - 1, paraItem);
             }
             else
             {
                 CommentMark mark = this.method_33(index, commentId, ownerParagraph.Items);
                 if ((mark != null) && (paraItem == ownerParagraph.Items[mark.method_5() - 1]))
                 {
                     int num = mark.method_5();
                     ownerParagraph.Items.RemoveAt(num - 1);
                     this.method_32(ownerParagraph, num, paraItem);
                 }
                 else
                 {
                     ParagraphBase base2 = paraItem.Clone() as ParagraphBase;
                     this.method_32(ownerParagraph, index - 1, base2);
                 }
             }
         }
     }
 }
        //Create the IF Field like:{IF { MERGEFIELD Count } > "100" "Thanks" " The minimum order is 100 units "}
        static void CreateIfField(Document document, Paragraph paragraph)
        {
            IfField ifField = new IfField(document);

            ifField.Type = FieldType.FieldIf;
            ifField.Code = "IF ";

            paragraph.Items.Add(ifField);
            paragraph.AppendField("Count", FieldType.FieldMergeField);
            paragraph.AppendText(" > ");
            paragraph.AppendText("\"100\" ");
            paragraph.AppendText("\"Thanks\" ");
            paragraph.AppendText("\"The minimum order is 100 units\"");

            IParagraphBase end = document.CreateParagraphItem(ParagraphItemType.FieldMark);

            (end as FieldMark).Type = FieldMarkType.FieldEnd;
            paragraph.Items.Add(end);
            ifField.End = end as FieldMark;
        }
        private void CreateIFField2(Document document, Paragraph paragraph)
        {
            IfField ifField = new IfField(document);

            ifField.Type = FieldType.FieldIf;
            ifField.Code = "IF ";
            paragraph.Items.Add(ifField);

            paragraph.AppendField("Age", FieldType.FieldMergeField);
            paragraph.AppendText(" > ");
            paragraph.AppendText("\"50\" ");
            paragraph.AppendText("\"The old man\" ");
            paragraph.AppendText("\"The young man\"");

            IParagraphBase end = document.CreateParagraphItem(ParagraphItemType.FieldMark);

            (end as FieldMark).Type = FieldMarkType.FieldEnd;
            paragraph.Items.Add(end);

            ifField.End = end as FieldMark;
        }
        private void CreateIFField1(Document document, Paragraph paragraph)
        {
            IfField ifField = new IfField(document);

            ifField.Type = FieldType.FieldIf;
            ifField.Code = "IF ";
            paragraph.Items.Add(ifField);

            paragraph.AppendField("Count", FieldType.FieldMergeField);
            paragraph.AppendText(" > ");
            paragraph.AppendText("\"1\" ");
            paragraph.AppendText("\"Greater than one\" ");
            paragraph.AppendText("\"Less than one\"");

            IParagraphBase end = document.CreateParagraphItem(ParagraphItemType.FieldMark);

            (end as FieldMark).Type = FieldMarkType.FieldEnd;
            paragraph.Items.Add(end);

            ifField.End = end as FieldMark;
        }
Example #7
0
 private void method_32(Paragraph A_0, int A_1, IParagraphBase A_2)
 {
     A_0.Items.Insert(A_1, A_2);
     (A_2 as ParagraphBase).method_0(A_0);
     this.Items.Add(A_2);
 }
Example #8
0
    private void method_10(IParagraphBase A_0)
    {
        IParagraphBase     base2 = A_0;
        DocumentObjectType documentObjectType = base2.DocumentObjectType;

        if (documentObjectType <= DocumentObjectType.TextRange)
        {
            switch (documentObjectType)
            {
            case DocumentObjectType.StructureDocumentTagInline:
                this.method_9((base2 as StructureDocumentTagInline).SDTContent.Items);
                break;

            case DocumentObjectType.TextRange:
                this.method_13(base2 as ITextRange);
                break;
            }
        }
        else
        {
            switch (documentObjectType)
            {
            case DocumentObjectType.Shape:
            {
                ShapeObject obj4 = base2 as ShapeObject;
                if (!obj4.HasInternalTextbox)
                {
                    if (obj4.IsGroup)
                    {
                        foreach (DocumentObject obj2 in obj4.ChildObjects)
                        {
                            if (obj2 is ParagraphBase)
                            {
                                this.method_10(obj2 as ParagraphBase);
                            }
                        }
                    }
                    break;
                }
                this.method_7(obj4.InternerTextbox.Body);
                return;
            }

            case DocumentObjectType.ShapeGroup:
            {
                ShapeGroup group = base2 as ShapeGroup;
                foreach (DocumentObject obj3 in group.ChildObjects)
                {
                    if (obj3 is ParagraphBase)
                    {
                        this.method_10(obj3 as ParagraphBase);
                    }
                }
                break;
            }

            case DocumentObjectType.TextBox:
                this.method_7((base2 as TextBox).Body);
                return;

            case DocumentObjectType.Break:
                if ((base2 as Break).BreakType != BreakType.LineBreak)
                {
                    break;
                }
                this.method_16();
                return;

            case DocumentObjectType.Symbol:
                this.method_14(base2 as Symbol);
                return;

            default:
                return;
            }
        }
    }