[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.PrintManager.GetPaginationInfo

GetPaginationInfo Method

GetPaginationInfo(IWorksheet, PaginationOrientation)

Gets the row or column indexes that define page boundaries for the specified worksheet.

The pagination result is calculated from the current page setup of the worksheet and the specified orientation.

If the worksheet has no print area, this method returns null.

Declaration
public IList<int> GetPaginationInfo(IWorksheet worksheet, PaginationOrientation orientation)
Public Function GetPaginationInfo(worksheet As IWorksheet, orientation As PaginationOrientation) As IList(Of Integer)
Parameters
Type Name Description
IWorksheet worksheet

The worksheet whose pagination information is retrieved. Must not be null.

PaginationOrientation orientation

The pagination direction that determines whether row or column boundary indexes are returned.

Returns
Type Description
IList<int>

A list of row or column indexes that represent the page boundaries for the specified orientation, or null if the worksheet has no print area.

Examples
worksheet.PageSetup.PrintArea = "A1:D80";
worksheet.Range["A1:D80"].Value = 100;
PrintManager printManager = new PrintManager();
IList<int> pageBoundaries = printManager.GetPaginationInfo(
    worksheet, PaginationOrientation.Vertical);

GetPaginationInfo(IWorksheet, PaginationOrientation, IList<IRange>, IList<RepeatSetting>)

Gets the row or column indexes that define page boundaries for the specified worksheet.

The pagination result is calculated from the current page setup of the worksheet and the specified orientation. Use keepTogetherRanges to prevent specific ranges from being split across pages, and use repeatSettings to repeat title or tail rows or columns for a range during pagination.

If the worksheet has no print area, this method returns null.

Declaration
public IList<int> GetPaginationInfo(IWorksheet worksheet, PaginationOrientation orientation, IList<IRange> keepTogetherRanges, IList<RepeatSetting> repeatSettings)
Public Function GetPaginationInfo(worksheet As IWorksheet, orientation As PaginationOrientation, keepTogetherRanges As IList(Of IRange), repeatSettings As IList(Of RepeatSetting)) As IList(Of Integer)
Parameters
Type Name Description
IWorksheet worksheet

The worksheet whose pagination information is retrieved. Must not be null.

PaginationOrientation orientation

The pagination direction that determines whether row or column boundary indexes are returned.

IList<IRange> keepTogetherRanges

The ranges that should remain on the same page. Can be null or empty if no keep-together ranges are needed.

IList<RepeatSetting> repeatSettings

The repeat settings applied during pagination. Can be null or empty if no repeating rows or columns are needed.

Returns
Type Description
IList<int>

A list of row or column indexes that represent the page boundaries for the specified orientation, or null if the worksheet has no print area.

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<int> pageBoundaries = printManager.GetPaginationInfo(
    worksheet, PaginationOrientation.Vertical, keepTogetherRanges, repeatSettings);
Exceptions
Type Condition
InvalidOperationException

if the keep-together or repeat settings cannot fit within the printable page area.