Interface IPageSetup
Represents the page setup description. The PageSetup object contains all page setup attributes (left margin, bottom margin, paper size, and so on) as properties.
Inherited Members
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.Base.dll
Syntax
public interface IPageSetup : IPageSetupBase, IParentApplication
Properties
FitToPagesTall
Returns or sets the height of the pages that the worksheet will be scaled to when it is printed. Applies only to worksheets. Read/write Boolean.
Declaration
int FitToPagesTall { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
To know more about page setting refer this link.
Examples
The following code illustrates how to fit all rows on one page.
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:M20"].Text = "PagePrint";
sheet.Range["A1:M1"].Text = "Page";
sheet.Range["C1:C20"].Text = "Page";
//Sets the fit to page tall as true.
sheet.PageSetup.FitToPagesTall = 1;
sheet.PageSetup.FitToPagesWide = 0;
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
FitToPagesWide
Returns or sets the width of the pages the worksheet will be scaled to when it is printed. Applies only to worksheets. Read/write Boolean.
Declaration
int FitToPagesWide { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
To know more about page settings refer this link.
Examples
The following code illustrates how to fit all columns on one page.
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:M20"].Text = "PagePrint";
sheet.Range["A1:M1"].Text = "Page";
sheet.Range["C1:C20"].Text = "Page";
//Sets the fit to page wide as true.
sheet.PageSetup.FitToPagesWide = 1;
sheet.PageSetup.FitToPagesTall = 0;
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
IsFitToPage
Indicates whether fit to page mode is selected. This property used to fit the page content before printing.
Declaration
bool IsFitToPage { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
To know more about page settings refer this link.
Examples
The following code illustrates the use of IsFitToPage 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:M20"].Text = "PagePrint";
sheet.Range["A1:M1"].Text = "Page";
sheet.Range["C1:C20"].Text = "Page";
// True to fit the content before printing
sheet.PageSetup.IsFitToPage = true;
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
IsSummaryColumnRight
Indicates whether summary columns will appear right of the detail in outlines. To enable SummaryColumnRight property the page Orientation must be Portrait and FitToPagesTall property value must be 0 and IsFitToPage property must be true.
Declaration
bool IsSummaryColumnRight { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
To know more about page settings refer this link.
Examples
The following code illustrates the use of IsSummaryColumnRight 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:M20"].Text = "PagePrint";
sheet.Range["A1:M1"].Text = "Page";
sheet.Range["C1:C20"].Text = "Page";
//True to summary columns will appear right of the detail in outlines
sheet.PageSetup.IsSummaryColumnRight = true;
sheet.PageSetup.Orientation = ExcelPageOrientation.Portrait;
sheet.PageSetup.FitToPagesTall = 0;
sheet.PageSetup.IsFitToPage = true;
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
IsSummaryRowBelow
Indicates whether summary rows will appear below detail in outlines. To enable SummaryRowBelow property the page Orientation must be Portrait and FitToPagesWide property value must be 0 and IsFitToPage property must be true.
Declaration
bool IsSummaryRowBelow { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
To know more about page settings refer this link.
Examples
The following code illustrates the use of IsSummaryRowBelow 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:M20"].Text = "PagePrint";
sheet.Range["A1:M1"].Text = "Page";
sheet.Range["C1:C20"].Text = "Page";
//True to summary rows will appear below detail in outlines
sheet.PageSetup.IsSummaryRowBelow = true;
sheet.PageSetup.FitToPagesWide = 0;
sheet.PageSetup.Orientation = ExcelPageOrientation.Portrait;
sheet.PageSetup.IsFitToPage = true;
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
PrintArea
Returns or sets the range to be printed, as a string using A1-style references in the language of the macro. Read / write System.String.
Declaration
string PrintArea { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
To know more about page settings refer this link.
Examples
The following code illustrates the use of PrintArea 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:M20"].Text = "PagePrint";
sheet.Range["A1:M1"].Text = "Page";
sheet.Range["C1:C20"].Text = "Page";
//Sets the range to be printed
sheet.PageSetup.PrintArea = "A1:M20";
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
PrintGridlines
True if cell gridlines are printed on the page. Applies only to worksheets.
Declaration
bool PrintGridlines { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
To know more about page settings refer this link.
Examples
The following code illustrates the use of PrintGridlines 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:M20"].Text = "PagePrint";
sheet.Range["A1:M1"].Text = "Page";
sheet.Range["C1:C20"].Text = "Page";
//True to cell gridlines are printed on the page
sheet.PageSetup.PrintGridlines = true;
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
PrintHeadings
True if row and column headings are printed with this page. Applies only to worksheets.
Declaration
bool PrintHeadings { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
To know more about page settings refer this link.
Examples
The following code illustrates the use of PrintHeadings 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:M20"].Text = "PagePrint";
sheet.Range["A1:M1"].Text = "Page";
sheet.Range["C1:C20"].Text = "Page";
//True to row and column headings are printed on page
sheet.PageSetup.PrintHeadings = true;
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
PrintTitleColumns
Returns or sets the columns that contain the cells to be repeated on the left side of each page, as a string in A1-style notation in the language of the macro. Read / write System.String.
Declaration
string PrintTitleColumns { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
To know more about page settings refer this link.
Examples
The following code illustrates the use of PrintTitleColumns 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:M20"].Text = "PagePrint";
sheet.Range["A1:M1"].Text = "Page";
sheet.Range["C1:C20"].Text = "Page";
//Sets the columns to be repeated on the left side of each page
sheet.PageSetup.PrintTitleColumns = "C1:C20";
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}
PrintTitleRows
Returns or sets the rows that contain the cells to be repeated at the top of each page, as a string in A1-style notation in the language of the macro. Read / write System.String.
Declaration
string PrintTitleRows { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
To know more about page settings refer this link.
Examples
The following code illustrates the use of PrintTitleRows 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:M20"].Text = "PagePrint";
sheet.Range["A1:M1"].Text = "Page";
sheet.Range["C1:C20"].Text = "Page";
//Sets the rows to be repeated at the top of each page
sheet.PageSetup.PrintTitleRows = "A1:M1";
workbook.SaveAs("PageSetup.xlsx");
workbook.Close();
}