[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.PrintManager.Paginate

Paginate Method

Paginate(IEnumerable<IWorkbook>)

Generates pagination information for all worksheets in all workbooks.

This method paginates each workbook in the specified list by calling Paginate(IWorkbook), combines the resulting PageInfo objects into a single list, and then updates the page number and page settings for the combined pages.

Declaration
public IList<PageInfo> Paginate(IEnumerable<IWorkbook> workbooks)
Public Function Paginate(workbooks As IEnumerable(Of IWorkbook)) As IList(Of PageInfo)
Parameters
Type Name Description
IEnumerable<IWorkbook> workbooks

The workbooks to paginate. The workbooks are processed in the order they appear in the list.

Returns
Type Description
IList<PageInfo>

A list of PageInfo objects generated from all workbooks. Returns an empty list if the specified list is empty.

Examples
worksheet.PageSetup.PrintArea = "B2:D6";
worksheet.Range["B2:D6"].Value = "Test";
List<IWorkbook> workbooks = new List<IWorkbook>();
workbooks.Add(workbook);
PrintManager printManager = new PrintManager();
IList<PageInfo> pages = printManager.Paginate(workbooks);

Paginate(IWorkbook)

Generate pagination informations for all worksheets in the workbook.

Declaration
public IList<PageInfo> Paginate(IWorkbook workbook)
Public Function Paginate(workbook As IWorkbook) As IList(Of PageInfo)
Parameters
Type Name Description
IWorkbook workbook

The workbook object.

Returns
Type Description
IList<PageInfo>

A list of PageInfo objects for all visible worksheets in the workbook. Returns an empty list if no pages are generated.

Examples
worksheet.PageSetup.PrintArea = "A1:B4";
worksheet.Range["A1:B4"].Value = new object[,]
{
    { "Name", "Value" },
    { "A", 100 },
    { "B", 200 },
    { "C", 300 }
};
PrintManager printManager = new PrintManager();
IList<PageInfo> pages = printManager.Paginate(workbook);

Paginate(IWorksheet)

Generate pagination information for the worksheet.

Declaration
public IList<PageInfo> Paginate(IWorksheet worksheet)
Public Function Paginate(worksheet As IWorksheet) As IList(Of PageInfo)
Parameters
Type Name Description
IWorksheet worksheet

The worksheet object.

Returns
Type Description
IList<PageInfo>

A list of PageInfo objects that describe the generated pages in page order. Returns an empty list if no printable pages are generated.

Examples
worksheet.PageSetup.PrintArea = "A1:B4";
worksheet.Range["A1:B4"].Value = new object[,]
{
    { "Name", "Value" },
    { "A", 100 },
    { "B", 200 },
    { "C", 300 }
};
PrintManager printManager = new PrintManager();
IList<PageInfo> pages = printManager.Paginate(worksheet);

Paginate(IWorksheet, IList<IRange>, IList<RepeatSetting>)

Generate pagination information for the worksheet.

Declaration
public IList<PageInfo> Paginate(IWorksheet worksheet, IList<IRange> keepTogetherRanges, IList<RepeatSetting> repeatSettings)
Public Function Paginate(worksheet As IWorksheet, keepTogetherRanges As IList(Of IRange), repeatSettings As IList(Of RepeatSetting)) As IList(Of PageInfo)
Parameters
Type Name Description
IWorksheet worksheet

The worksheet object.

IList<IRange> keepTogetherRanges

The collection of ranges that need to keep together.

IList<RepeatSetting> repeatSettings

The collection of repeat settings for a Range.

Returns
Type Description
IList<PageInfo>
Examples
worksheet.PageSetup.PrintArea = "A1:D80";
worksheet.Range["A1:D80"].Value = 100;
List<IRange> keepTogetherRanges = new List<IRange>();
keepTogetherRanges.Add(worksheet.Range["A20:D25"]);
RepeatSetting repeatSetting = new RepeatSetting();
repeatSetting.Range = worksheet.Range["A1:D80"];
repeatSetting.TitleRowStart = 0;
repeatSetting.TitleRowEnd = 0;
List<RepeatSetting> repeatSettings = new List<RepeatSetting>();
repeatSettings.Add(repeatSetting);
PrintManager printManager = new PrintManager();
IList<PageInfo> pages = printManager.Paginate(worksheet, keepTogetherRanges, repeatSettings);

Paginate(IRange)

Generate pagination information for the range.

Declaration
public IList<PageInfo> Paginate(IRange printArea)
Public Function Paginate(printArea As IRange) As IList(Of PageInfo)
Parameters
Type Name Description
IRange printArea

The area will be paginated.

Returns
Type Description
IList<PageInfo>

A list of PageInfo objects that describe the generated pages for the specified range in page order. Returns an empty list if no printable pages are generated.