C#: Online Guide
How To: Word SDK
Header & Footer Processing
Header & Footer Processing
  |  
Home ›› XDoc.Word ›› C# Word: Process Header & Footer

C# Word - Header & Footer Processing in C#.NET


Provide a Series of Methods to Process Footer & Header in Word Document for C# Users




Overview



By using C#.NET Word document header & footer processing Interface control (XDoc.Word).//More TODO, users are able to process header and footer on Word document. read text from pdf c#, mvc view to pdf itextsharp, open pdf and draw c#, asp.net mvc convert pdf to image, tiffbitmapencoder example c#, c# code 128.


Related .net document control helps:
asp.net office viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net pdf editor component: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
c# asp.net mvc document viewer: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
asp.net edit pdf page control: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
asp.net pdf viewer control free: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
asp.net document viewer example: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
asp.net dicom library: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET




C# DLLs: Word Header and Footer Processing



Add references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.XDoc.Word.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.Word;




Create Footer & Header



The following C# sample code will show you how to create a header and footer in section. There's no content in section until blocks are created in it. vb.net pdf to tiff, vb.net pdf page count, vb.net convert pdf to text file, itextsharp remove text from pdf c#, image to pdf vb.net, vb.net pdf print library, c# pdf viewer open source.




String docFilePath = @"";
//Open the document
DOCXDocument document =DOCXDocument.Open(docFilePath);
//Get the main document
IDocument doc = document.GetDocument();
//Create a section
ISection section = doc.CreateSection(0);
//Create a header for section
IHeader header = section.CreateHeader(HeaderAndFooterType.Default);
//More TODO:may create some block in header.

//Create a footer for section
IFooter footer = section.CreateFooter(HeaderAndFooterType.Default);
//More TODO:may create some block in footer.

//Save the document
doc.Save(@"");





Create and Add Paragraph to Footer & Header



Like main body story, header and footer of Word also contains a series of blocks such as normal paragraphs and tables. asp.net itextsharp add image to pdf, pdf viewer asp.net control open source, asp. net mvc pdf viewer, asp.net view excel in browser, preview pdf in asp.net, asp.net show image from server, pdf editor asp.net. And we provide various methods to process them, the following demo code will show you how to create paragraph in header and footer.




String docFilePath = @"";
//Open the document
DOCXDocument document = DOCXDocument.Open(docFilePath);
//Get the main document
IDocument doc = document.GetDocument();
//Create a section for document
ISection section = doc.CreateSection(0);
//Create a header for section
IHeader header = section.CreateHeader(HeaderAndFooterType.Default);
//Just Show how to Create a paragraph for header
IParagraph paragraph = header.CreateParagraph();
//Create a run and text in paragraph
IRun run = paragraph.CreateARun();
run.CreateText("Header");

//MORE TODO:
//
//
doc.Save(@"");





Create and Add Table to Footer & Header



The following demo code shows how to create table in footer and header.




String docFilePath = @"";
//Open the document
DOCXDocument document = DOCXDocument.Open(docFilePath);
//Get the main document
IDocument doc = document.GetDocument();
//Create a section for document
ISection section = doc.CreateSection(0);
//Create a header for section
IHeader header = section.CreateHeader(HeaderAndFooterType.Default);
//Just show how to Create a table for header
ITable table= header.CreateTable(3, 3);
//MORE TODO:
//
//
doc.Save(@"");