HeaderFooter

HeaderFooter constructor

Belirtilen türde yeni bir üst bilgi veya alt bilgi oluşturur.

public HeaderFooter(DocumentBase doc, HeaderFooterType headerFooterType)
ParametreTipTanım
docDocumentBaseSahibi belgesi.
headerFooterTypeHeaderFooterTypeAHeaderFooterType üstbilgi veya altbilginin türünü belirten value .

Notlar

Ne zamanHeaderFooter oluşturulduysa, belirtilen belgeye aittir ancak henüz değildir ve belgenin bir parçası değildir veParentNode dır-dirhükümsüz.

EklemekHeaderFooterbirSection kullanmakInsertAfter ,InsertBefore , veyaHeadersFooters özellik ve yöntemlerAdd ,Insert.

Örnekler

Üstbilgi ve altbilginin nasıl oluşturulacağını gösterir.

Document doc = new Document();

// Bir başlık oluşturun ve ona bir paragraf ekleyin. O paragraftaki metin
// bu bölümün her sayfasının üst kısmında, ana metin metninin üstünde görünecektir.
HeaderFooter header = new HeaderFooter(doc, HeaderFooterType.HeaderPrimary);
doc.FirstSection.HeadersFooters.Add(header);

Paragraph para = header.AppendParagraph("My header.");

Assert.True(header.IsHeader);
Assert.True(para.IsEndOfHeaderFooter);

// Bir altbilgi oluşturun ve ona bir paragraf ekleyin. O paragraftaki metin
// bu bölümün her sayfasının altında, ana gövde metninin altında görünecektir.
HeaderFooter footer = new HeaderFooter(doc, HeaderFooterType.FooterPrimary);
doc.FirstSection.HeadersFooters.Add(footer);

para = footer.AppendParagraph("My footer.");

Assert.False(footer.IsHeader);
Assert.True(para.IsEndOfHeaderFooter);

Assert.AreEqual(footer, para.ParentStory);
Assert.AreEqual(footer.ParentSection, para.ParentSection);
Assert.AreEqual(footer.ParentSection, header.ParentSection);

doc.Save(ArtifactsDir + "HeaderFooter.Create.docx");

Ayrıca bakınız