Interface IPage
Base interface for Page class.
Namespace: Syncfusion.XlsIO.Interfaces
Assembly: Syncfusion.XlsIO.NET.dll
Syntax
public interface IPage
Properties
CenterFooter
Gets or sets center part of footer. Read/write string
Declaration
string CenterFooter { get; set; }
Property Value
Type |
---|
System.String |
Remarks
&L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P+number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. To know more about page settings refer this link.
Examples
The following code illustrates the use of CenterFooter property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1:T100"].Text = "PagePrint";
sheet.PageSetup.DifferentFirstPageHF = true;
//sets center part of footer
sheet.PageSetup.FirstPage.CenterFooter = "Center Footer &G";
sheet.PageSetup.FirstPage.CenterFooterImage = System.Drawing.Image.FromFile("sample1.jpg");
sheet.PageSetup.FirstPage.RightHeader = "Right Header &G";
sheet.PageSetup.FirstPage.RightHeaderImage = System.Drawing.Image.FromFile("sample6.jpg");
sheet.PageSetup.FirstPage.CenterHeader = "Center Header &G";
sheet.PageSetup.FirstPage.CenterHeaderImage = System.Drawing.Image.FromFile("sample2.jpg");
sheet.PageSetup.FirstPage.LeftHeader = "Left Header &G";
sheet.PageSetup.FirstPage.LeftHeaderImage = System.Drawing.Image.FromFile("sample4.jpg");
sheet.PageSetup.FirstPage.LeftFooter = "Left Footer &G";
sheet.PageSetup.FirstPage.LeftFooterImage = System.Drawing.Image.FromFile("sample3.jpg");
sheet.PageSetup.FirstPage.RightFooter = "Right Footer &G";
sheet.PageSetup.FirstPage.RightFooterImage = System.Drawing.Image.FromFile("sample5.jpg");
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
CenterFooterImage
Gets or sets image for center part of footer.
Declaration
Image CenterFooterImage { get; set; }
Property Value
Type |
---|
Image |
Remarks
&L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P+number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. To know more about page settings refer this link.
Examples
The following code illustrates the use of CenterFooterImage property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1:T100"].Text = "PagePrint";
sheet.PageSetup.DifferentFirstPageHF = true;
//sets the image for center part of footer
sheet.PageSetup.FirstPage.CenterFooterImage = System.Drawing.Image.FromFile("sample1.jpg");
sheet.PageSetup.FirstPage.CenterFooter = "Center Footer &G";
sheet.PageSetup.FirstPage.RightHeader = "Right Header &G";
sheet.PageSetup.FirstPage.RightHeaderImage = System.Drawing.Image.FromFile("sample6.jpg");
sheet.PageSetup.FirstPage.CenterHeader = "Center Header &G";
sheet.PageSetup.FirstPage.CenterHeaderImage = System.Drawing.Image.FromFile("sample2.jpg");
sheet.PageSetup.FirstPage.LeftHeader = "Left Header &G";
sheet.PageSetup.FirstPage.LeftHeaderImage = System.Drawing.Image.FromFile("sample4.jpg");
sheet.PageSetup.FirstPage.LeftFooter = "Left Footer &G";
sheet.PageSetup.FirstPage.LeftFooterImage = System.Drawing.Image.FromFile("sample3.jpg");
sheet.PageSetup.FirstPage.RightFooter = "Right Footer &G";
sheet.PageSetup.FirstPage.RightFooterImage = System.Drawing.Image.FromFile("sample5.jpg");
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
CenterHeader
Gets or sets center part of header. Read/write string
Declaration
string CenterHeader { get; set; }
Property Value
Type |
---|
System.String |
Remarks
&L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P+number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. To know more about page settings refer this link.
Examples
The following code illustrates the use of CenterHeader property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1:T100"].Text = "PagePrint";
sheet.PageSetup.DifferentFirstPageHF = true;
//sets center part of header
sheet.PageSetup.FirstPage.CenterHeader = "Center Header &G";
sheet.PageSetup.FirstPage.CenterHeaderImage = System.Drawing.Image.FromFile("sample2.jpg");
sheet.PageSetup.FirstPage.LeftHeader = "Left Header &G";
sheet.PageSetup.FirstPage.LeftHeaderImage = System.Drawing.Image.FromFile("sample4.jpg");
sheet.PageSetup.FirstPage.CenterFooter = "Center Footer &G";
sheet.PageSetup.FirstPage.CenterFooterImage = System.Drawing.Image.FromFile("sample1.jpg");
sheet.PageSetup.FirstPage.LeftFooter = "Left Footer &G";
sheet.PageSetup.FirstPage.LeftFooterImage = System.Drawing.Image.FromFile("sample3.jpg");
sheet.PageSetup.FirstPage.RightFooter = "Right Footer &G";
sheet.PageSetup.FirstPage.RightFooterImage = System.Drawing.Image.FromFile("sample5.jpg");
sheet.PageSetup.FirstPage.RightHeader = "Right Header &G";
sheet.PageSetup.FirstPage.RightHeaderImage = System.Drawing.Image.FromFile("sample6.jpg");
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
CenterHeaderImage
Gets or sets image for center part of header.
Declaration
Image CenterHeaderImage { get; set; }
Property Value
Type |
---|
Image |
Remarks
&L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P+number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. To know more about page settings refer this link.
Examples
The following code illustrates the use of CenterHeaderImage property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1:T100"].Text = "PagePrint";
sheet.PageSetup.DifferentFirstPageHF = true;
//sets the image for center part of header
sheet.PageSetup.FirstPage.CenterHeaderImage = System.Drawing.Image.FromFile("sample2.jpg");
sheet.PageSetup.FirstPage.CenterHeader = "Center Header &G";
sheet.PageSetup.FirstPage.LeftHeader = "Left Header &G";
sheet.PageSetup.FirstPage.LeftHeaderImage = System.Drawing.Image.FromFile("sample4.jpg");
sheet.PageSetup.FirstPage.CenterFooter = "Center Footer &G";
sheet.PageSetup.FirstPage.CenterFooterImage = System.Drawing.Image.FromFile("sample1.jpg");
sheet.PageSetup.FirstPage.LeftFooter = "Left Footer &G";
sheet.PageSetup.FirstPage.LeftFooterImage = System.Drawing.Image.FromFile("sample3.jpg");
sheet.PageSetup.FirstPage.RightFooter = "Right Footer &G";
sheet.PageSetup.FirstPage.RightFooterImage = System.Drawing.Image.FromFile("sample5.jpg");
sheet.PageSetup.FirstPage.RightHeader = "Right Header &G";
sheet.PageSetup.FirstPage.RightHeaderImage = System.Drawing.Image.FromFile("sample6.jpg");
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
LeftFooter
Gets or sets left part of footer. Read/write string
Declaration
string LeftFooter { get; set; }
Property Value
Type |
---|
System.String |
Remarks
&L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P+number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. To know more about page settings refer this link.
Examples
The following code illustrates the use of LeftFooter property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1:T100"].Text = "PagePrint";
sheet.PageSetup.DifferentFirstPageHF = true;
//sets left part of footer
sheet.PageSetup.FirstPage.LeftFooter = "Left Footer &G";
sheet.PageSetup.FirstPage.LeftFooterImage = System.Drawing.Image.FromFile("sample3.jpg");
sheet.PageSetup.FirstPage.RightHeader = "Right Header &G";
sheet.PageSetup.FirstPage.RightHeaderImage = System.Drawing.Image.FromFile("sample6.jpg");
sheet.PageSetup.FirstPage.CenterHeader = "Center Header &G";
sheet.PageSetup.FirstPage.CenterHeaderImage = System.Drawing.Image.FromFile("sample2.jpg");
sheet.PageSetup.FirstPage.LeftHeader = "Left Header &G";
sheet.PageSetup.FirstPage.LeftHeaderImage = System.Drawing.Image.FromFile("sample4.jpg");
sheet.PageSetup.FirstPage.CenterFooter = "Center Footer &G";
sheet.PageSetup.FirstPage.CenterFooterImage = System.Drawing.Image.FromFile("sample1.jpg");
sheet.PageSetup.FirstPage.RightFooter = "Right Footer &G";
sheet.PageSetup.FirstPage.RightFooterImage = System.Drawing.Image.FromFile("sample5.jpg");
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
LeftFooterImage
Gets or sets image for left part of footer.
Declaration
Image LeftFooterImage { get; set; }
Property Value
Type |
---|
Image |
Remarks
&L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P+number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. To know more about page settings refer this link.
Examples
The following code illustrates the use of LeftFooterImage property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1:T100"].Text = "PagePrint";
sheet.PageSetup.DifferentFirstPageHF = true;
//sets the image for left part of footer
sheet.PageSetup.FirstPage.LeftFooterImage = System.Drawing.Image.FromFile("sample3.jpg");
sheet.PageSetup.FirstPage.LeftFooter = "Left Footer &G";
sheet.PageSetup.FirstPage.RightHeader = "Right Header &G";
sheet.PageSetup.FirstPage.RightHeaderImage = System.Drawing.Image.FromFile("sample6.jpg");
sheet.PageSetup.FirstPage.CenterHeader = "Center Header &G";
sheet.PageSetup.FirstPage.CenterHeaderImage = System.Drawing.Image.FromFile("sample2.jpg");
sheet.PageSetup.FirstPage.LeftHeader = "Left Header &G";
sheet.PageSetup.FirstPage.LeftHeaderImage = System.Drawing.Image.FromFile("sample4.jpg");
sheet.PageSetup.FirstPage.CenterFooter = "Center Footer &G";
sheet.PageSetup.FirstPage.CenterFooterImage = System.Drawing.Image.FromFile("sample1.jpg");
sheet.PageSetup.FirstPage.RightFooter = "Right Footer &G";
sheet.PageSetup.FirstPage.RightFooterImage = System.Drawing.Image.FromFile("sample5.jpg");
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
LeftHeader
Gets or sets left part of header. Read/write string
Declaration
string LeftHeader { get; set; }
Property Value
Type |
---|
System.String |
Remarks
&L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P+number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. To know more about page settings refer this link.
Examples
The following code illustrates the use of LeftHeader property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1:T100"].Text = "PagePrint";
sheet.PageSetup.DifferentFirstPageHF = true;
//sets left part of header
sheet.PageSetup.FirstPage.LeftHeader = "Left Header &G";
sheet.PageSetup.FirstPage.LeftHeaderImage = System.Drawing.Image.FromFile("sample4.jpg");
sheet.PageSetup.FirstPage.CenterFooter = "Center Footer &G";
sheet.PageSetup.FirstPage.CenterFooterImage = System.Drawing.Image.FromFile("sample1.jpg");
sheet.PageSetup.FirstPage.CenterHeader = "Center Header &G";
sheet.PageSetup.FirstPage.CenterHeaderImage = System.Drawing.Image.FromFile("sample2.jpg");
sheet.PageSetup.FirstPage.LeftFooter = "Left Footer &G";
sheet.PageSetup.FirstPage.LeftFooterImage = System.Drawing.Image.FromFile("sample3.jpg");
sheet.PageSetup.FirstPage.RightFooter = "Right Footer &G";
sheet.PageSetup.FirstPage.RightFooterImage = System.Drawing.Image.FromFile("sample5.jpg");
sheet.PageSetup.FirstPage.RightHeader = "Right Header &G";
sheet.PageSetup.FirstPage.RightHeaderImage = System.Drawing.Image.FromFile("sample6.jpg");
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
LeftHeaderImage
Gets or sets image for left part of header.
Declaration
Image LeftHeaderImage { get; set; }
Property Value
Type |
---|
Image |
Remarks
&L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P+number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. To know more about page settings refer this link.
Examples
The following code illustrates the use of LeftHeaderImage property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1:T100"].Text = "PagePrint";
sheet.PageSetup.DifferentFirstPageHF = true;
//sets the image for left part of header
sheet.PageSetup.FirstPage.LeftHeaderImage = System.Drawing.Image.FromFile("sample4.jpg");
sheet.PageSetup.FirstPage.LeftHeader = "Left Header &G";
sheet.PageSetup.FirstPage.CenterFooter = "Center Footer &G";
sheet.PageSetup.FirstPage.CenterFooterImage = System.Drawing.Image.FromFile("sample1.jpg");
sheet.PageSetup.FirstPage.CenterHeader = "Center Header &G";
sheet.PageSetup.FirstPage.CenterHeaderImage = System.Drawing.Image.FromFile("sample2.jpg");
sheet.PageSetup.FirstPage.LeftFooter = "Left Footer &G";
sheet.PageSetup.FirstPage.LeftFooterImage = System.Drawing.Image.FromFile("sample3.jpg");
sheet.PageSetup.FirstPage.RightFooter = "Right Footer &G";
sheet.PageSetup.FirstPage.RightFooterImage = System.Drawing.Image.FromFile("sample5.jpg");
sheet.PageSetup.FirstPage.RightHeader = "Right Header &G";
sheet.PageSetup.FirstPage.RightHeaderImage = System.Drawing.Image.FromFile("sample6.jpg");
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
RightFooter
Gets or sets right part of footer. Read/write string
Declaration
string RightFooter { get; set; }
Property Value
Type |
---|
System.String |
Remarks
&L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P+number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. To know more about page settings refer this link.
Examples
The following code illustrates the use of RightFooter property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1:T100"].Text = "PagePrint";
sheet.PageSetup.DifferentFirstPageHF = true;
//sets right part of footer
sheet.PageSetup.FirstPage.RightFooter = "Right Footer &G";
sheet.PageSetup.FirstPage.RightFooterImage = System.Drawing.Image.FromFile("sample5.jpg");
sheet.PageSetup.FirstPage.CenterFooter = "Center Footer &G";
sheet.PageSetup.FirstPage.CenterFooterImage = System.Drawing.Image.FromFile("sample1.jpg");
sheet.PageSetup.FirstPage.RightHeader = "Right Header &G";
sheet.PageSetup.FirstPage.RightHeaderImage = System.Drawing.Image.FromFile("sample6.jpg");
sheet.PageSetup.FirstPage.CenterHeader = "Center Header &G";
sheet.PageSetup.FirstPage.CenterHeaderImage = System.Drawing.Image.FromFile("sample2.jpg");
sheet.PageSetup.FirstPage.LeftHeader = "Left Header &G";
sheet.PageSetup.FirstPage.LeftHeaderImage = System.Drawing.Image.FromFile("sample4.jpg");
sheet.PageSetup.FirstPage.LeftFooter = "Left Footer &G";
sheet.PageSetup.FirstPage.LeftFooterImage = System.Drawing.Image.FromFile("sample3.jpg");
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
RightFooterImage
Gets or sets image for right part of footer.
Declaration
Image RightFooterImage { get; set; }
Property Value
Type |
---|
Image |
Remarks
&L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P+number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. To know more about page settings refer this link.
Examples
The following code illustrates the use of RightFooterImage property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1:T100"].Text = "PagePrint";
sheet.PageSetup.DifferentFirstPageHF = true;
//sets the image for right part of footer
sheet.PageSetup.FirstPage.RightFooterImage = System.Drawing.Image.FromFile("sample5.jpg");
sheet.PageSetup.FirstPage.RightFooter = "Right Footer &G";
sheet.PageSetup.FirstPage.CenterFooter = "Center Footer &G";
sheet.PageSetup.FirstPage.CenterFooterImage = System.Drawing.Image.FromFile("sample1.jpg");
sheet.PageSetup.FirstPage.RightHeader = "Right Header &G";
sheet.PageSetup.FirstPage.RightHeaderImage = System.Drawing.Image.FromFile("sample6.jpg");
sheet.PageSetup.FirstPage.CenterHeader = "Center Header &G";
sheet.PageSetup.FirstPage.CenterHeaderImage = System.Drawing.Image.FromFile("sample2.jpg");
sheet.PageSetup.FirstPage.LeftHeader = "Left Header &G";
sheet.PageSetup.FirstPage.LeftHeaderImage = System.Drawing.Image.FromFile("sample4.jpg");
sheet.PageSetup.FirstPage.LeftFooter = "Left Footer &G";
sheet.PageSetup.FirstPage.LeftFooterImage = System.Drawing.Image.FromFile("sample3.jpg");
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
RightHeader
Gets or sets right part of header. Read/write string
Declaration
string RightHeader { get; set; }
Property Value
Type |
---|
System.String |
Remarks
&L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P+number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. To know more about page settings refer this link.
Examples
The following code illustrates the use of RightHeader property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1:T100"].Text = "PagePrint";
sheet.PageSetup.DifferentFirstPageHF = true;
//sets right part of header
sheet.PageSetup.FirstPage.RightHeader = "Right Header &G";
sheet.PageSetup.FirstPage.RightHeaderImage = System.Drawing.Image.FromFile("sample6.jpg");
sheet.PageSetup.FirstPage.CenterHeader = "Center Header &G";
sheet.PageSetup.FirstPage.CenterHeaderImage = System.Drawing.Image.FromFile("sample2.jpg");
sheet.PageSetup.FirstPage.LeftHeader = "Left Header &G";
sheet.PageSetup.FirstPage.LeftHeaderImage = System.Drawing.Image.FromFile("sample4.jpg");
sheet.PageSetup.FirstPage.CenterFooter = "Center Footer &G";
sheet.PageSetup.FirstPage.CenterFooterImage = System.Drawing.Image.FromFile("sample1.jpg");
sheet.PageSetup.FirstPage.LeftFooter = "Left Footer &G";
sheet.PageSetup.FirstPage.LeftFooterImage = System.Drawing.Image.FromFile("sample3.jpg");
sheet.PageSetup.FirstPage.RightFooter = "Right Footer &G";
sheet.PageSetup.FirstPage.RightFooterImage = System.Drawing.Image.FromFile("sample5.jpg");
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
RightHeaderImage
Gets or sets image for right part of header.
Declaration
Image RightHeaderImage { get; set; }
Property Value
Type |
---|
Image |
Remarks
&L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P+number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. To know more about page settings refer this link.
Examples
The following code illustrates the use of RightHeaderImage property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.Range["A1:T100"].Text = "PagePrint";
sheet.PageSetup.DifferentFirstPageHF = true;
//sets the image for right part of header
sheet.PageSetup.FirstPage.RightHeaderImage = System.Drawing.Image.FromFile("sample6.jpg");
sheet.PageSetup.FirstPage.RightHeader = "Right Header &G";
sheet.PageSetup.FirstPage.CenterHeader = "Center Header &G";
sheet.PageSetup.FirstPage.CenterHeaderImage = System.Drawing.Image.FromFile("sample2.jpg");
sheet.PageSetup.FirstPage.LeftHeader = "Left Header &G";
sheet.PageSetup.FirstPage.LeftHeaderImage = System.Drawing.Image.FromFile("sample4.jpg");
sheet.PageSetup.FirstPage.CenterFooter = "Center Footer &G";
sheet.PageSetup.FirstPage.CenterFooterImage = System.Drawing.Image.FromFile("sample1.jpg");
sheet.PageSetup.FirstPage.LeftFooter = "Left Footer &G";
sheet.PageSetup.FirstPage.LeftFooterImage = System.Drawing.Image.FromFile("sample3.jpg");
sheet.PageSetup.FirstPage.RightFooter = "Right Footer &G";
sheet.PageSetup.FirstPage.RightFooterImage = System.Drawing.Image.FromFile("sample5.jpg");
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}