예제 #1
0
        private static void ProcessSection(Section section, HeaderFooterType headerFooterType, SubDocumentDelegate subDocumentProcessor)
        {
            if (section.HasHeader(headerFooterType))
            {
                SubDocument header = section.BeginUpdateHeader(headerFooterType);
                try
                {
                    subDocumentProcessor(header);
                    ProcessShapes(header.Shapes, subDocumentProcessor);
                }
                finally
                {
                    section.EndUpdateHeader(header);
                }
            }

            if (section.HasFooter(headerFooterType))
            {
                SubDocument footer = section.BeginUpdateFooter(headerFooterType);
                try
                {
                    subDocumentProcessor(footer);
                    ProcessShapes(footer.Shapes, subDocumentProcessor);
                }
                finally
                {
                    section.EndUpdateFooter(footer);
                }
            }
        }
        //ExStart:InsertBarcodeIntoFooter
        private void InsertBarcodeIntoFooter(DocumentBuilder builder, Section section,
                                             HeaderFooterType footerType)
        {
            // Move to the footer type in the specific section.
            builder.MoveToSection(section.Document.IndexOf(section));
            builder.MoveToHeaderFooter(footerType);

            // Insert the barcode, then move to the next line and insert the ID along with the page number.
            // Use pageId if you need to insert a different barcode on each page. 0 = First page, 1 = Second page etc.
            builder.InsertImage(Image.FromFile(ImagesDir + "Barcode.png"));
            builder.Writeln();
            builder.Write("1234567890");
            builder.InsertField("PAGE");

            // Create a right-aligned tab at the right margin.
            double tabPos = section.PageSetup.PageWidth - section.PageSetup.RightMargin - section.PageSetup.LeftMargin;

            builder.CurrentParagraph.ParagraphFormat.TabStops.Add(new TabStop(tabPos, TabAlignment.Right,
                                                                              TabLeader.None));

            // Move to the right-hand side of the page and insert the page and page total.
            builder.Write(ControlChar.Tab);
            builder.InsertField("PAGE");
            builder.Write(" of ");
            builder.InsertField("NUMPAGES");
        }
 internal RtfHeaderFooter(HeaderFooterType type, ReadingDirection direction)
     : base(true, false, true, true, false)
 {
     _magicWords      = new Hashtable();
     _type            = type;
     ReadingDirection = direction;
 }
        private static void SetHeaderFooter(HeaderFooterType headerFootertype, Page page, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, HeaderFooterConfig headerFooterConfig, string text, int pageNumber, Package package, bool isHeader)
        {
            switch (headerFootertype)
            {
            case HeaderFooterType.Company:
                AddText(page, horizontalAlignment, verticalAlignment, headerFooterConfig, package.CompanyName, isHeader, package);
                break;

            case HeaderFooterType.Copyright:
                AddText(page, horizontalAlignment, verticalAlignment, headerFooterConfig, package.CopyrightText, isHeader, package);
                break;

            case HeaderFooterType.CustomText:
                AddText(page, horizontalAlignment, verticalAlignment, headerFooterConfig, text, isHeader, package);
                break;

            case HeaderFooterType.Date:
                AddText(page, horizontalAlignment, verticalAlignment, headerFooterConfig, DateTime.Now.ToShortDateString(), isHeader, package);
                break;

            case HeaderFooterType.PageNumber:
                if (pageNumber > 0)
                {
                    AddText(page, horizontalAlignment, verticalAlignment, headerFooterConfig, (pageNumber).ToString(CultureInfo.InvariantCulture), isHeader, package);
                }
                break;

            case HeaderFooterType.Logo:
                AddImage(page, horizontalAlignment, verticalAlignment, headerFooterConfig, package.GroupLogo, isHeader, package);
                break;

            default:
                return;
            }
        }
예제 #5
0
    internal static void smethod_2(Class108 A_0, Class108 A_1, HeaderFooterType A_2)
    {
        HeaderFooter footer = A_1.method_8().HeadersFooters[A_2];

        switch (A_2)
        {
        case HeaderFooterType.HeaderEven:
            A_0.method_8().HeadersFooters[HeaderFooterType.HeaderEven] = footer;
            return;

        case HeaderFooterType.HeaderOdd:
            A_0.method_8().HeadersFooters[HeaderFooterType.HeaderOdd] = footer;
            return;

        case HeaderFooterType.FooterEven:
            A_0.method_8().HeadersFooters[HeaderFooterType.FooterEven] = footer;
            return;

        case HeaderFooterType.FooterOdd:
            A_0.method_8().HeadersFooters[HeaderFooterType.FooterOdd] = footer;
            return;

        case HeaderFooterType.HeaderFirstPage:
            A_0.method_8().HeadersFooters[HeaderFooterType.HeaderFirstPage] = footer;
            return;

        case HeaderFooterType.FooterFirstPage:
            A_0.method_8().HeadersFooters[HeaderFooterType.FooterFirstPage] = footer;
            return;
        }
    }
예제 #6
0
    private IBody method_20(Section A_0, int A_1)
    {
        HeaderFooterType type = A_0.PageSetup.DifferentFirstPageHeaderFooter ? HeaderFooterType.HeaderFirstPage : HeaderFooterType.HeaderOdd;

        if (A_0.HeadersFooters[type].LinkToPrevious && (A_1 > 0))
        {
            int num = A_1 - 1;
            while (num >= 0)
            {
                Section      section = this.document_0.Sections[num];
                HeaderFooter footer  = section.HeadersFooters[type];
                if ((type == footer.Type) && footer.LinkToPrevious)
                {
                    num--;
                }
                else if ((type == footer.Type) && !footer.LinkToPrevious)
                {
                    A_0.HeadersFooters[type] = section.HeadersFooters[type];
                    break;
                }
            }
        }
        if (A_0.PageSetup.DifferentFirstPageHeaderFooter)
        {
            return(A_0.HeadersFooters.FirstPageHeader);
        }
        return(A_0.HeadersFooters.Header);
    }
예제 #7
0
        public HeaderFooter this[HeaderFooterType A_0]
        {
            get
            {
                int num = 1;
                switch (hfType)
                {
                case HeaderFooterType.HeaderEven:
                    return(this.EvenHeader);

                case HeaderFooterType.HeaderOdd:
                    return(this.OddHeader);

                case HeaderFooterType.FooterEven:
                    return(this.EvenFooter);

                case HeaderFooterType.FooterOdd:
                    return(this.OddFooter);

                case HeaderFooterType.HeaderFirstPage:
                    return(this.FirstPageHeader);

                case HeaderFooterType.FooterFirstPage:
                    return(this.FirstPageFooter);
                }
                throw new ArgumentException(BookmarkStart.b("渦䜨崪䰬䌮堰圲ᔴ弶尸娺夼娾㍀求⍄⡆♈㽊⡌㵎煐❒ⱔ❖㱘", num), BookmarkStart.b("伦伨缪听弮吰", num));
            }
            internal set
            {
                int num = 8;
                switch (A_0)
                {
                case HeaderFooterType.HeaderEven:
                    this.headerFooter_0 = value;
                    return;

                case HeaderFooterType.HeaderOdd:
                    this.headerFooter_2 = value;
                    return;

                case HeaderFooterType.FooterEven:
                    this.headerFooter_3 = value;
                    return;

                case HeaderFooterType.FooterOdd:
                    this.headerFooter_1 = value;
                    return;

                case HeaderFooterType.HeaderFirstPage:
                    this.headerFooter_4 = value;
                    return;

                case HeaderFooterType.FooterFirstPage:
                    this.headerFooter_5 = value;
                    return;
                }
                throw new ArgumentException(BookmarkStart.b("札帯䐱唳娵儷帹᰻嘽┿⍁⁃⍅㩇敉⩋⅍㽏♑ㅓ⑕硗⹙╛⹝՟", num), BookmarkStart.b("䘭嘯昱䴳䘵崷", num));
            }
        }
 // Get by header footer type is an overloaded indexer.
 public HeaderFooter this[HeaderFooterType headerFooterType]
 {
     //ExSkip
     get                 //ExSkip
     {                   //ExSkip
         return null;    //ExSkip
     }                   //ExSkip
 }
예제 #9
0
    private static void smethod_3(Section A_0, HeaderFooterType A_1, Interface52 A_2)
    {
        HeaderFooter footer = A_0.HeadersFooters[A_1];

        if ((footer != null) && (footer.ChildObjects.Count > 0))
        {
            A_2.imethod_7(footer);
        }
    }
예제 #10
0
파일: Tag.cs 프로젝트: rettigcd/Outfish
 public HeaderFooter(string src, int begin, int end, string name, HeaderFooterType type)
 {
     this.Source         = src;
     this.Begin          = begin;
     this.End            = end;
     this.Name           = name;
     this.NameLowerCased = name.ToLower();
     this.Type           = type;
 }
예제 #11
0
    private HeaderFooter method_31(Section A_0, HeaderFooterType A_1)
    {
        HeaderFooter footer = A_0.HeadersFooters[A_1];

        if ((footer != null) && footer.HasChildElements)
        {
            this.hashtable_0[footer.Type] = footer;
            return(footer);
        }
        return((HeaderFooter)this.hashtable_0[A_1]);
    }
예제 #12
0
        private void InsertToHeader(Paragraph para, Section section, HeaderFooterType headerType)
        {
            HeaderFooter header = section.HeadersFooters[headerType];

            if (header == null)
            {
                header = new HeaderFooter(section.Document, headerType);
                section.HeadersFooters.Add(header);
            }

            header.AppendChild(para.Clone(true));
        }
예제 #13
0
    private void method_2(HeaderFooterType A_0)
    {
        Class760 class2 = this.class764_0.method_8().method_25(this.int_1, A_0);

        if ((class2 != null) && (class2.method_6() > 0))
        {
            Class1108 class3 = new Class1108(this.class764_0, SubDocumentType.Header);
            this.class764_0.method_43().imethod_6(A_0);
            class3.method_4(class2.method_2(), class2.method_6());
            this.class764_0.method_43().imethod_7();
        }
    }
예제 #14
0
        private static void InsertWatermarkIntoHeader(Paragraph watermarkPara, Section sect, HeaderFooterType headerType)
        {
            HeaderFooter header = sect.HeadersFooters[headerType];

            if (header == null)
            {
                // There is no header of the specified type in the current section, create it.
                header = new HeaderFooter(sect.Document, headerType);
                sect.HeadersFooters.Add(header);
            }

            // Insert a clone of the watermark into the header.
            header.AppendChild(watermarkPara.Clone(true));
        }
예제 #15
0
        /// <summary>
        /// 在页头插入水印文本
        /// </summary>
        /// <param name="watermarkPara"></param>
        /// <param name="sect"></param>
        /// <param name="headerType"></param>
        public void insertWatermarkIntoHeader(Paragraph watermarkPara, Section sect, HeaderFooterType headerType)
        {
            HeaderFooter header = sect.HeadersFooters[headerType];

            if (header == null)
            {
                // There is no header of the specified type in the current section, create it.
                header = new HeaderFooter(sect.Document, headerType);
                sect.HeadersFooters.Add(header);
            }

            // Insert a clone of the watermark into the header.
            header.AppendChild(watermarkPara.Clone(true));
        }
예제 #16
0
    private static void smethod_1(Section A_0, Class581 A_1)
    {
        Class394         class2 = A_1.imethod_1();
        bool             flag   = class2.method_1() == BookmarkStart.b("䈩䠫尭", 4);
        HeaderFooterType type   = Class339.smethod_4(class2.method_12(BookmarkStart.b("帩唫席唯", 4), ""), flag);
        HeaderFooter     footer = new HeaderFooter(A_0, type);

        A_1.method_16(true);
        Class629.smethod_0(A_1, footer);
        A_1.method_16(false);
        A_0.HeadersFooters[type] = footer;
        if (A_0.HeadersFooters[footer.Type] == null)
        {
            A_0.method_18(footer, A_0.Body);
        }
    }
예제 #17
0
        HeaderFooter ParseHeaderFooter()
        {
            if (_curIndex >= _source.Length)
            {
                throw new FormatException("begin is out of bounds.");
            }
            if (_source[_curIndex] != '<')
            {
                throw new FormatException("first char must be a '<'");
            }

            int              end  = FindEndOfTag();
            string           name = GetTagName(end);
            HeaderFooterType type = PickHeaderFooterType(end);

            return(new HeaderFooter(_source, _curIndex, end, name, type));
        }
예제 #18
0
    private void method_30(Section A_0, HeaderFooterType A_1, string A_2)
    {
        bool         flag;
        HeaderFooter footer = this.method_31(A_0, A_1);

        if (flag = (footer != null) && (this.class422_0.method_23() == OpenDocumentWritingStage.StylesMasterPage))
        {
            this.class400_0.method_4(A_2);
        }
        if (footer != null)
        {
            footer.Accept(this.class422_0);
        }
        if (flag)
        {
            this.class400_0.method_5();
        }
    }
        // ExStart:InsertBarcodeIntoFooter
        private static void InsertBarcodeIntoFooter(DocumentBuilder builder, Section section, int pageId, HeaderFooterType footerType)
        {
            // Move to the footer type in the specific section.
            builder.MoveToSection(section.Document.IndexOf(section));
            builder.MoveToHeaderFooter(footerType);

            // Insert the barcode, then move to the next line and insert the ID along with the page number.
            // Use pageId if you need to insert a different barcode on each page. 0 = First page, 1 = Second page etc.    
            builder.InsertImage(System.Drawing.Image.FromFile( RunExamples.GetDataDir_WorkingWithImages() + "Barcode1.png"));
            builder.Writeln();
            builder.Write("1234567890");
            builder.InsertField("PAGE");

            // Create a right aligned tab at the right margin.
            double tabPos = section.PageSetup.PageWidth - section.PageSetup.RightMargin - section.PageSetup.LeftMargin;
            builder.CurrentParagraph.ParagraphFormat.TabStops.Add(new TabStop(tabPos, TabAlignment.Right, TabLeader.None));

            // Move to the right hand side of the page and insert the page and page total.
            builder.Write(ControlChar.Tab);
            builder.InsertField("PAGE");
            builder.Write(" of ");
            builder.InsertField("NUMPAGES");
        }
예제 #20
0
    private void imethod_6(HeaderFooterType A_0)
    {
        if (this.documentObject_0 is Section)
        {
            Section section = this.documentObject_0 as Section;
            switch (A_0)
            {
            case HeaderFooterType.HeaderEven:
                this.method_12(section.HeadersFooters.EvenHeader);
                return;

            case HeaderFooterType.HeaderOdd:
                this.method_12(section.HeadersFooters.OddHeader);
                return;

            case HeaderFooterType.FooterEven:
                this.method_12(section.HeadersFooters.EvenFooter);
                return;

            case HeaderFooterType.FooterOdd:
                this.method_12(section.HeadersFooters.OddFooter);
                return;

            case HeaderFooterType.HeaderFirstPage:
                this.method_12(section.HeadersFooters.FirstPageHeader);
                return;

            case HeaderFooterType.FooterFirstPage:
                this.method_12(section.HeadersFooters.FirstPageFooter);
                break;

            default:
                return;
            }
        }
    }
예제 #21
0
    internal static string smethod_5(HeaderFooterType A_0, bool A_1)
    {
        int num = 3;

        switch (A_0)
        {
        case HeaderFooterType.HeaderEven:
        case HeaderFooterType.FooterEven:
            return(BookmarkStart.b("䰨崪䠬䄮", num));

        case HeaderFooterType.HeaderOdd:
        case HeaderFooterType.FooterOdd:
            if (A_1)
            {
                return(BookmarkStart.b("䴨个䬬丮䐰弲䄴", num));
            }
            return(BookmarkStart.b("䘨伪䤬", num));

        case HeaderFooterType.HeaderFirstPage:
        case HeaderFooterType.FooterFirstPage:
            return(BookmarkStart.b("伨䈪弬尮䔰", num));
        }
        throw new InvalidOperationException(BookmarkStart.b("簨䔪䘬䄮帰䐲嬴᜶儸帺尼嬾⑀ㅂ敄ⅆ♈⑊㥌⩎⍐獒⅔⹖⥘㹚獜", num));
    }
        private static void AppendFooter(Section sourceSection, Section targetSection, HeaderFooterType headerFooterType)
        {
            if (!sourceSection.HasFooter(headerFooterType))
            {
                return;
            }

            SubDocument source = sourceSection.BeginUpdateFooter(headerFooterType);
            SubDocument target = targetSection.BeginUpdateFooter(headerFooterType);

            target.Delete(target.Range);
            target.InsertDocumentContent(target.Range.Start, source.Range, InsertOptions.KeepSourceFormatting);

            // Delete empty paragraphs
            DocumentRange emptyParagraph = target.CreateRange(target.Range.End.ToInt() - 1, 1);

            target.Delete(emptyParagraph);

            sourceSection.EndUpdateFooter(source);
            targetSection.EndUpdateFooter(target);
        }
예제 #23
0
        private void InsertWatermarkIntoHeader(Paragraph watermarkPara, Section sect, HeaderFooterType headerFooterType)
        {
            HeaderFooter header = sect.HeadersFooters[headerFooterType];

            if (header == null)
            {
                header = new HeaderFooter(sect.Document, headerFooterType);
                sect.HeadersFooters.Add(header);
            }

            Node newNode = header.AppendChild(watermarkPara.Clone(true));
        }
예제 #24
0
 internal RtfHeaderFooter(HeaderFooterType type)
     : base(true, false, true, true, false)
 {
     _magicWords = new Hashtable();
     _type       = type;
 }
예제 #25
0
    internal Class760 method_25(int A_0, HeaderFooterType A_1)
    {
        int num = (6 + (A_0 * 6)) + A_1;

        return(this.method_27(num));
    }
예제 #26
0
 internal HeaderFooter(Section A_0, HeaderFooterType A_1) : base(A_0)
 {
     this.headerFooterType_0 = A_1;
     this.bool_6             = true;
 }
 internal void SetExtraInfo(HeaderFooterType headerFooterType, int index)
 {
     m_headerFooterType = headerFooterType;
     m_index            = index;
 }
 internal RtfHeaderFooter(HeaderFooterType type)
     : this(type, ReadingDirection.LeftToRight)
 {
 }
예제 #29
0
 internal RtfHeaderFooter(HeaderFooterType type)
     : base(true, false, true, true, false)
 {
     _type = type;
 }
예제 #30
0
        private static void InsertWatermarkIntoHeader(Aspose.Words.Paragraph watermarkPara, Aspose.Words.Section sect, HeaderFooterType headerType)
        {
            Aspose.Words.HeaderFooter header = sect.HeadersFooters[headerType];

            if (header == null)
            {
                header = new Aspose.Words.HeaderFooter(sect.Document, headerType);
                sect.HeadersFooters.Add(header);
            }
            header.AppendChild(watermarkPara.Clone(true));
        }
예제 #31
0
파일: Program.cs 프로젝트: HuaGeWuDi/CSharp
        private static void InsertWatermarkIntoHeader(Paragraph watermarkPara, Section sect, HeaderFooterType headerType)
        {
            HeaderFooter header = sect.HeadersFooters[headerType];

            if (header == null)
            {
                // 当前节中没有指定类型的头,创建它
                header = new HeaderFooter(sect.Document, headerType);
                sect.HeadersFooters.Add(header);
            }

            // 在头部插入一个水印的克隆
            header.AppendChild(watermarkPara.Clone(true));
        }
		internal RtfHeaderFooter(HeaderFooterType type)
			: base(true, false, true, true, false)
		{
			_magicWords = new Hashtable();
			_type = type;
		}
 internal void SetExtraInfo( HeaderFooterType headerFooterType, int index )
 {
   m_headerFooterType = headerFooterType;
   m_index = index;
 }
예제 #34
0
    internal static void smethod_0(Class857 A_0, Class108 A_1, string A_2)
    {
        int              num        = 6;
        Class92          class2     = A_0.method_13().method_2(A_1.method_4(), null, A_0.method_20(), true) as Class92;
        HeaderFooterType type       = smethod_1(A_1, A_2);
        HeaderFooter     evenHeader = null;

        switch (type)
        {
        case HeaderFooterType.HeaderEven:
            evenHeader = A_1.method_8().HeadersFooters.EvenHeader;
            break;

        case HeaderFooterType.HeaderOdd:
            evenHeader = A_1.method_8().HeadersFooters.OddHeader;
            break;

        case HeaderFooterType.FooterEven:
            evenHeader = A_1.method_8().HeadersFooters.EvenFooter;
            break;

        case HeaderFooterType.FooterOdd:
            evenHeader = A_1.method_8().HeadersFooters.OddFooter;
            break;

        case HeaderFooterType.HeaderFirstPage:
            evenHeader = A_1.method_8().HeadersFooters.FirstPageHeader;
            break;

        case HeaderFooterType.FooterFirstPage:
            evenHeader = A_1.method_8().HeadersFooters.FirstPageFooter;
            break;
        }
        Class17 class3 = null;

        if (class2 != null)
        {
            Class107 class4 = A_2.StartsWith(BookmarkStart.b("䐫䬭儯嘱儳䐵", num)) ? class2.method_12() : class2.method_14();
            if (class4 != null)
            {
                class3 = class4.method_4();
            }
            if (A_2.EndsWith(BookmarkStart.b("ī䈭唯吱䀳", num)))
            {
                A_0.method_9().Settings.bool_37 = true;
            }
            if (class3 != null)
            {
                class3.method_37(A_1.method_8().SectPr);
            }
            while (A_0.method_11().method_9(A_2))
            {
                string key = A_0.method_11().method_1();
                if (key != null)
                {
                    int num2;
                    if (Class1160.dictionary_109 == null)
                    {
                        Dictionary <string, int> dictionary1 = new Dictionary <string, int>(11);
                        dictionary1.Add(BookmarkStart.b("尫", num), 0);
                        dictionary1.Add(BookmarkStart.b("䐫", num), 1);
                        dictionary1.Add(BookmarkStart.b("䀫䜭䌯䘱", num), 2);
                        dictionary1.Add(BookmarkStart.b("堫伭刯帱儳", num), 3);
                        dictionary1.Add(BookmarkStart.b("堫伭刯帱儳ᬵ圷尹ᄻ崽⼿ⱁぃ⍅♇㹉", num), 4);
                        dictionary1.Add(BookmarkStart.b("䴫䈭䀯娱唳吵崷丹唻崽ℿ⹁楃⽅♇⹉⥋㙍", num), 5);
                        dictionary1.Add(BookmarkStart.b("䔫䈭尯䜱䜳䈵䨷嬹䠻圽⼿ⱁ楃⽅♇⹉⥋㙍", num), 6);
                        dictionary1.Add(BookmarkStart.b("堫伭刯帱儳ᬵ儷吹堻嬽㠿", num), 7);
                        dictionary1.Add(BookmarkStart.b("䌫䰭娯圱圳䈵ᔷ匹刻娽┿㩁", num), 8);
                        dictionary1.Add(BookmarkStart.b("夫崭唯䀱ᤳ張嘷帹夻䘽", num), 9);
                        dictionary1.Add(BookmarkStart.b("丫䜭刯帱崳夵強䠹崻丽⠿㭁", num), 10);
                        Class1160.dictionary_109 = dictionary1;
                    }
                    if (Class1160.dictionary_109.TryGetValue(key, out num2))
                    {
                        switch (num2)
                        {
                        case 0:
                        case 1:
                        {
                            Class1099.smethod_1(A_0, A_0.method_11().method_1(), evenHeader);
                            continue;
                        }

                        case 2:
                        {
                            Class530.smethod_0(A_0, evenHeader, null);
                            continue;
                        }

                        case 3:
                        {
                            Class90.smethod_0(A_0, evenHeader);
                            continue;
                        }

                        case 4:
                        case 5:
                        case 6:
                        case 7:
                        case 8:
                        case 9:
                        case 10:
                        {
                            if (!Class246.smethod_0(A_0, evenHeader, A_1))
                            {
                                A_0.method_11().vmethod_1();
                            }
                            continue;
                        }
                        }
                    }
                }
                A_0.method_11().vmethod_1();
            }
        }
    }