To set web-based pagination options

Parent Previous Next

 

Report Application Server .NET SDK Developer Guide

To set web-based pagination options


 







  1. Get the report print options and create a copy.

Visual Basic

Dim printOutputController As PrintOutputController = rcd.PrintOutputController
Dim printOptions As PrintOptions = printOutputController.GetPrintOptions()
Dim newPrintOptions As PrintOptions = printOptions.Clone(True)

C#

PrintOutputController printOutputController = rcd.PrintOutputController;
PrintOptions printOptions = printOutputController.GetPrintOptions();
PrintOptions newPrintOptions = printOptions.Clone(true);

  1. Dissociate report page size from printer page sizes.

Visual Basic

newPrintOptions.DissociatePageSizeAndPrinterPaperSize = False

C#

newPrintOptions.DissociatePageSizeAndPrinterPaperSize = false;

  1. Set the report print size.

Visual Basic

newPrintOptions.PaperSize = CrPaperSizeEnum.crPaperSizePaperLegal

C#

newPrintOptions.PaperSize = CrPaperSizeEnum.crPaperSizePaperLegal;

  1. Set the orientation of the report.

Visual Basic

newPrintOptions.PaperOrientation = CrPaperOrientationEnum.crPaperOrientationLandscape

C#

newPrintOptions.PaperOrientation = CrPaperOrientationEnum.crPaperOrientationLandscape;

  1. Modify the print options.

Visual Basic

printOutputController.ModifyPrintOptions(newPrintOptions)

C#

printOutputController.ModifyPrintOptions(newPrintOptions);

NoteNote

Non-standard paper sizes can be set using the printOutputController.ModifyUserPaperSize method.

  1. Set the number of data records to paginate on.

Visual Basic

Dim detailArea As ISCRArea = rcd.ReportDefinition.DetailArea
Dim areaFormat As ISCRAreaFormat = detailArea.Format
areaFormat.VisibleRecordNumberPerPage = 1
rcd.ReportDefController.ReportAreaController.SetProperty(detailArea, CrReportAreaPropertyEnum.crReportAreaPropertyFormat, areaFormat)

C#

ISCRArea detailArea = rcd.ReportDefinition.DetailArea;
ISCRAreaFormat areaFormat = detailArea.Format;
areaFormat.VisibleRecordNumberPerPage = 1;
rcd.ReportDefController.ReportAreaController.SetProperty(detailArea, CrReportAreaPropertyEnum.crReportAreaPropertyFormat, areaFormat);

  1. Enable the clamp page footer.

Visual Basic

Dim footerArea As ISCRArea = rcd.ReportDefinition.PageFooterArea
Dim footerFormat As ISCRAreaFormat = footerArea.Format
footerFormat.EnableClampPageFooter = True
rcd.ReportDefController.ReportAreaController.SetProperty(footerArea, CrReportAreaPropertyEnum.crReportAreaPropertyFormat, footerFormat)

C#

ISCRArea footerArea = rcd.ReportDefinition.PageFooterArea;
ISCRAreaFormat footerFormat = footerArea.Format;
footerFormat.EnableClampPageFooter = true;
rcd.ReportDefController.ReportAreaController.SetProperty(footerArea, CrReportAreaPropertyEnum.crReportAreaPropertyFormat, footerFormat);

  1. Set the orientation of the report header section.

Visual Basic

Dim reportSectionController As ReportSectionController = rcd.ReportDefController.ReportSectionController
Dim section As CrystalDecisions.ReportAppServer.ReportDefModel.Section = rcd.ReportDefController.ReportDefinition.ReportHeaderArea.Sections(0)
Dim newSectionFormat As CrystalDecisions.ReportAppServer.ReportDefModel.SectionFormat = section.Format
newSectionFormat.PageOrientation = CrPaperOrientationEnum.crPaperOrientationLandscape
reportSectionController.SetProperty(section, CrReportSectionPropertyEnum.crReportSectionPropertyFormat, newSectionFormat)

C#

ReportSectionController reportSectionController = rcd.ReportDefController.ReportSectionController;
CrystalDecisions.ReportAppServer.ReportDefModel.Section section = rcd.ReportDefController.ReportDefinition.ReportHeaderArea.Sections[0];
CrystalDecisions.ReportAppServer.ReportDefModel.SectionFormat newSectionFormat = section.Format;
newSectionFormat.PageOrientation = CrPaperOrientationEnum.crPaperOrientationLandscape;
reportSectionController.SetProperty(section, CrReportSectionPropertyEnum.crReportSectionPropertyFormat, newSectionFormat);

This sample shows you how to set different page sizes for print and web in the same report, set the number of data records to paginate on, enable the clamp page footer, and change the orientation of a section.

Visual Basic

Private Shared Sub SetWebPagination(ByVal rcd As ISCDReportClientDocument)
 Dim printOutputController As PrintOutputController = rcd.PrintOutputController
 Dim printOptions As PrintOptions = printOutputController.GetPrintOptions()
 Dim newPrintOptions As PrintOptions = printOptions.Clone(True)
 newPrintOptions.DissociatePageSizeAndPrinterPaperSize = True
 newPrintOptions.PaperSize = CrPaperSizeEnum.crPaperSizePaperLegal
 newPrintOptions.PaperOrientation = CrPaperOrientationEnum.crPaperOrientationLandscape
 printOutputController.ModifyPrintOptions(newPrintOptions)
 Dim detailArea As ISCRArea = rcd.ReportDefinition.DetailArea
 Dim areaFormat As ISCRAreaFormat = detailArea.Format
 areaFormat.VisibleRecordNumberPerPage = 1
 rcd.ReportDefController.ReportAreaController.SetProperty(detailArea, CrReportAreaPropertyEnum.crReportAreaPropertyFormat, areaFormat)
 Dim footerArea As ISCRArea = rcd.ReportDefinition.PageFooterArea
 Dim footerFormat As ISCRAreaFormat = footerArea.Format
 footerFormat.EnableClampPageFooter = True
 rcd.ReportDefController.ReportAreaController.SetProperty(footerArea, CrReportAreaPropertyEnum.crReportAreaPropertyFormat, footerFormat)
 Dim reportSectionController As ReportSectionController = rcd.ReportDefController.ReportSectionController
 Dim section As CrystalDecisions.ReportAppServer.ReportDefModel.Section = rcd.ReportDefController.ReportDefinition.ReportHeaderArea.Sections(0)
 Dim newSectionFormat As CrystalDecisions.ReportAppServer.ReportDefModel.SectionFormat = section.Format
 newSectionFormat.PageOrientation = CrPaperOrientationEnum.crPaperOrientationPortrait
 reportSectionController.SetProperty(section, CrReportSectionPropertyEnum.crReportSectionPropertyFormat, newSectionFormat)
End Sub

C#

private static void SetWebPagination(ISCDReportClientDocument rcd)
{
 PrintOutputController printOutputController = rcd.PrintOutputController;
 PrintOptions printOptions = printOutputController.GetPrintOptions();
 PrintOptions newPrintOptions = printOptions.Clone(true);
 newPrintOptions.DissociatePageSizeAndPrinterPaperSize = true;
 newPrintOptions.PaperSize = CrPaperSizeEnum.crPaperSizePaperLegal;
 newPrintOptions.PaperOrientation = CrPaperOrientationEnum.crPaperOrientationLandscape;
 printOutputController.ModifyPrintOptions(newPrintOptions);
 ISCRArea detailArea = rcd.ReportDefinition.DetailArea;
 ISCRAreaFormat areaFormat = detailArea.Format;
 areaFormat.VisibleRecordNumberPerPage = 1;
 rcd.ReportDefController.ReportAreaController.SetProperty(detailArea, CrReportAreaPropertyEnum.crReportAreaPropertyFormat, areaFormat);
 ISCRArea footerArea = rcd.ReportDefinition.PageFooterArea;
 ISCRAreaFormat footerFormat = footerArea.Format;
 footerFormat.EnableClampPageFooter = true;
 rcd.ReportDefController.ReportAreaController.SetProperty(footerArea, CrReportAreaPropertyEnum.crReportAreaPropertyFormat, footerFormat);
 ReportSectionController reportSectionController = rcd.ReportDefController.ReportSectionController;
 CrystalDecisions.ReportAppServer.ReportDefModel.Section section = rcd.ReportDefController.ReportDefinition.ReportHeaderArea.Sections[0];
 CrystalDecisions.ReportAppServer.ReportDefModel.SectionFormat newSectionFormat = section.Format;
 newSectionFormat.PageOrientation = CrPaperOrientationEnum.crPaperOrientationPortrait;
 reportSectionController.SetProperty(section, CrReportSectionPropertyEnum.crReportSectionPropertyFormat, newSectionFormat);
}

This list includes the namespaces used by the sample code:

© 2021 SAP AG. All rights reserved.

http://www.sap.com/sapbusinessobjects/

Support services

http://service.sap.com/bosap-support/

Created with the Personal Edition of HelpNDoc: Easily create iPhone documentation