SubDocument myHeader = firstSection.BeginUpdateHeader(HeaderFooterType.First) ĭocumentRange range = myHeader.InsertText(myHeader.CreatePosition(0), " PAGE NUMBER ") įield fld = (range.End, "PAGE \\* ARABICDASH") Modify the header of the HeaderFooterType.First type. You cannot add comments to headers’ or footers’ text. Headers and footers can contain inline images, floating objects (text boxes or images) and tables. Call the Section.BeginUpdateHeader or Section.BeginUpdateFooter method to access the header’s or footer’s content. Headers’ and footers’ content are in a separate SubDocument. If Not firstSection.HasHeader(HeaderFooterType.Primary) Thenĭim headerDocument As SubDocument = firstSection.BeginUpdateHeader()įirstSection.EndUpdateHeader(headerDocument) ' Check whether the document already has a header (the same header for all pages). Using wordProcessor As New RichEditDocumentServer()ĭim document As Document = wordProcessor.Documentĭim firstSection As Section = document.Sections(0) SubDocument headerDocument = firstSection.BeginUpdateHeader() įirstSection.EndUpdateHeader(headerDocument) If (!firstSection.HasHeader(HeaderFooterType.Primary)) Check whether the document already has a header (the same header for all pages). Section firstSection = document.Sections Using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())ĭocument document = wordProcessor.Document The code sample below creates an empty document header: Use the following API to access headers and footers in code: APIĪccesses the document’s header or footer.Ĭhecks whether the given section contains a header or footer. Pass one of the HeaderFooterType enumeration values as a type parameter to define the header or footer’s type. You can use the Section.BeginUpdateHeader and Section.BeginUpdateFooter methods to access the section’s header or footer. When you create a new section, it is automatically linked to the previous section and the content from the first section header is automatically inserted in the second section header. If a section does not have header or footer, the previous section’s header and footer (if any) are used. Headers and footers belong to document sections.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |