Skip to content

Commit

Permalink
Updated gist and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
falleretic committed Nov 22, 2023
1 parent 2557937 commit 8f7bdd5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private void RemoveSectionBreaks(Document doc)
public void RemoveFooters()
{
//ExStart:RemoveFooters
//GistDesc:Create headers and footers using C#
//GistId:84cab3a22008f041ee6c1e959da09949
Document doc = new Document(MyDir + "Header and footer types.docx");

foreach (Section section in doc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ internal class WorkingWithHeadersAndFooters : DocsExamplesBase
public void CreateHeaderFooter()
{
//ExStart:CreateHeaderFooter
//GistDesc:Create headers and footers using C#
//GistId:84cab3a22008f041ee6c1e959da09949
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

//ExStart:HeaderFooterType
//GistDesc:Create headers and footers using C#
//GistId:84cab3a22008f041ee6c1e959da09949
builder.MoveToHeaderFooter(HeaderFooterType.HeaderFirst);
builder.Write("Aspose.Words Header Creation Primer.");
builder.Write("Header for the first page.");
//ExEnd:HeaderFooterType

builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.Write("Aspose.Words Footer Creation Primer.");
builder.Write("Header for odd page.");

doc.Save(ArtifactsDir + "WorkingWithHeadersAndFooters.CreateHeaderFooter.docx");
//ExEnd:CreateHeaderFooter
Expand All @@ -31,7 +31,7 @@ public void CreateHeaderFooter()
public void DifferentFirstPage()
{
//ExStart:DifferentFirstPage
//GistDesc:Create headers and footers using C#
//GistId:84cab3a22008f041ee6c1e959da09949
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Expand All @@ -54,7 +54,7 @@ public void DifferentFirstPage()
public void OddEvenPages()
{
//ExStart:OddEvenPages
//GistDesc:Create headers and footers using C#
//GistId:84cab3a22008f041ee6c1e959da09949
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Expand All @@ -79,7 +79,7 @@ public void OddEvenPages()
public void InsertImage()
{
//ExStart:InsertImage
//GistDesc:Create headers and footers using C#
//GistId:84cab3a22008f041ee6c1e959da09949
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Expand All @@ -95,18 +95,16 @@ public void InsertImage()
public void FontProps()
{
//ExStart:FontProps
//GistDesc:Create headers and footers using C#
//GistId:84cab3a22008f041ee6c1e959da09949
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;

builder.Font.Name = "Arial";
builder.Font.Bold = true;
builder.Font.Size = 14;

builder.Write("Aspose.Words Header/Footer Creation Primer");
builder.Write("Header for odd page.");

doc.Save(ArtifactsDir + "WorkingWithHeadersAndFooters.HeaderFooterFontProps.docx");
//ExEnd:FontProps
Expand All @@ -116,7 +114,7 @@ public void FontProps()
public void PageNumbers()
{
//ExStart:PageNumbers
//GistDesc:Create headers and footers using C#
//GistId:84cab3a22008f041ee6c1e959da09949
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Expand All @@ -135,7 +133,7 @@ public void PageNumbers()
public void LinkToPreviousHeaderFooter()
{
//ExStart:LinkToPreviousHeaderFooter
//GistDesc:Create headers and footers using C#
//GistId:84cab3a22008f041ee6c1e959da09949
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Expand All @@ -146,7 +144,7 @@ public void LinkToPreviousHeaderFooter()
builder.Font.Name = "Arial";
builder.Font.Bold = true;
builder.Font.Size = 14;
builder.Write("Aspose.Words Header Creation Primer.");
builder.Write("Header for the first page.");

builder.MoveToDocumentEnd();
builder.InsertBreak(BreakType.SectionBreakNewPage);
Expand All @@ -169,7 +167,7 @@ public void LinkToPreviousHeaderFooter()

builder.Font.Name = "Arial";
builder.Font.Size = 12;
builder.Write("New Aspose.Words Header Creation Primer.");
builder.Write("New Header for the first page.");

doc.Save(ArtifactsDir + "WorkingWithHeadersAndFooters.LinkToPreviousHeaderFooter.docx");
//ExEnd:LinkToPreviousHeaderFooter
Expand All @@ -179,9 +177,9 @@ public void LinkToPreviousHeaderFooter()
[Test]
public void SectionsWithDifferentHeaders()
{
//ExStart:SectionsWithDifferentHeaders
//OldName:DifferentFirstPageHeaderFooter
//ExStart:SectionsWithDifferentHeaders
//GistId:1afca4d3da7cb4240fb91c3d93d8c30d
//OldName:DifferentFirstPageHeaderFooter
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Expand All @@ -194,22 +192,22 @@ public void SectionsWithDifferentHeaders()
builder.Font.Name = "Arial";
builder.Font.Bold = true;
builder.Font.Size = 14;
builder.Write("Aspose.Words Header/Footer Creation Primer - Title Page.");
builder.Write("Header for the first page.");

builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
// Insert a positioned image into the top/left corner of the header.
// Distance from the top/left edges of the page is set to 10 points.
builder.InsertImage(ImagesDir + "Logo.jpg", RelativeHorizontalPosition.Page, 10,
RelativeVerticalPosition.Page, 10, 50, 50, WrapType.Through);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write("Aspose.Words Header/Footer Creation Primer.");
builder.Write("Header for odd page.");

doc.Save(ArtifactsDir + "WorkingWithHeadersAndFooters.SectionsWithDifferentHeaders.docx");
//ExEnd:SectionsWithDifferentHeaders
}

//ExStart:CopyHeadersFootersFromPreviousSection
//GistDesc:Create headers and footers using C#
//GistId:84cab3a22008f041ee6c1e959da09949
/// <summary>
/// Clones and copies headers/footers form the previous section to the specified section.
/// </summary>
Expand Down

0 comments on commit 8f7bdd5

Please sign in to comment.