Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > IPivotTable Interface : RepeatItemsOnEachPrintedPage Property

RepeatItemsOnEachPrintedPage Property

Gets or sets a Boolean value indicating whether labels must be repeated on every page.The default value is True.
Syntax
'Declaration
 
Property RepeatItemsOnEachPrintedPage As Boolean
'Usage
 
Dim instance As IPivotTable
Dim value As Boolean
 
instance.RepeatItemsOnEachPrintedPage = value
 
value = instance.RepeatItemsOnEachPrintedPage
bool RepeatItemsOnEachPrintedPage {get; set;}
Remarks
True if row, column, and item labels appear on the first row of each page when the specified PivotTable report is printed. False if labels are printed only on the first page. To know more about Pivot Tables refer this link.
Example
Following code illustrates use of RepeatItemsOnEachPrintedPage property in the pivot table.
using Syncfusion.XlsIO;
            
class Example
{
   static void Main()
   {
      using (ExcelEngine excelEngine = new ExcelEngine())
      {
        //Create a worksheet.        
        IApplication application = excelEngine.Excel;
        application.DefaultVersion = ExcelVersion.Excel2013;
        IWorkbook workbook = application.Workbooks.Create(2);
        IWorksheet sheet = workbook.Worksheets[0];
        IWorksheet pivotSheet = workbook.Worksheets[1];
        sheet.Range["A1"].Text = "Student ID";
        sheet.Range["B1"].Text = "Student Name";
        sheet.Range["C1"].Text = "Mark(Out of 100)";
        sheet.Range["A1:C1"].AutofitColumns();
        sheet.Range["A2"].Number = 1;
        sheet.Range["A3"].Number = 2;
        sheet.Range["A4"].Number = 3;
        sheet.Range["A5"].Number = 4;
        sheet.Range["A6"].Number = 5;
        sheet.Range["B2"].Text = "Andrew";
        sheet.Range["B3"].Text = "Marson";
        sheet.Range["B4"].Text = "Jack";
        sheet.Range["B5"].Text = "Sam";
        sheet.Range["B6"].Text = "Breto";
        sheet.Range["C2"].Number = 77;
        sheet.Range["C3"].Number = 45;
        sheet.Range["C4"].Number = 92;
        sheet.Range["C5"].Number = 39;
        sheet.Range["C6"].Number = 55;
        IPivotCache cache = workbook.PivotCaches.Add(sheet["A1:C6"]);
        IPivotTable pivotTable = pivotSheet.PivotTables.Add("PivotTable1", pivotSheet["A1"], cache);
        
        //Sets a Boolean value indicating whether labels must be repeated on every page
        pivotTable.RepeatItemsOnEachPrintedPage = true;
        
        pivotTable.Fields[0].Axis = PivotAxisTypes.Column;
        pivotTable.Fields[1].Axis = PivotAxisTypes.Row;
        IPivotField datafield = pivotTable.Fields[2];
        pivotTable.DataFields.Add(datafield, "Sum of Marks", PivotSubtotalTypes.Sum);
        pivotTable.BuiltInStyle = PivotBuiltInStyles.PivotStyleMedium20;
        workbook.SaveAs("PivotTables.xlsx");
        workbook.Close();
      }
   }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also