To set a page margin condition formula with the PrintOutputController class

Parent Previous Next

 

Report Application Server .NET SDK Developer Guide

To set a page margin condition formula with the PrintOutputController class


 







  1. Retrieve an instance of the PrintOutputController object.
  2. Create a new IConditionFormula object.
  3. Set the formula syntax and text.
  4. Use the PrintOutputController.setPageMarginFormula method to modify the page margin conditional formula.

This sample creates a formula that checks whether a page number is even or odd and sets the margins accordingly: if the page is an even number, the margin is set to one inch; if the page is an odd number, the margin is set to two inches. The formula is applied to the left margin of the report.

Visual Basic

Private Sub SetPageMarginConditionFormulaController(ByVal rcd As ISCDReportClientDocument)
 Dim printOutputController As PrintOutputController = rcd.PrintOutputController
 Dim condFormula As ConditionFormula = New ConditionFormulaClass()
 Dim formulaText As String = "If Remainder(pagenumber,2) = 0 then 1440 else 2880"
 condFormula.Syntax = CrFormulaSyntaxEnum.crFormulaSyntaxCrystal
 condFormula.Text = formulaText
 printOutputController.SetPageMarginFormula(CrPageMarginConditionFormulaTypeEnum.crPageMarginConditionFormulaTypeLeft, condFormula)
End Sub

C#

private void SetPageMarginConditionFormulaController(ISCDReportClientDocument rcd)
{
 PrintOutputController printOutputController = rcd.PrintOutputController;
 ConditionFormula condFormula = new ConditionFormulaClass();
 String formulaText = "If Remainder(pagenumber,2) = 0 then 1440 else 2880";
 condFormula.Syntax = CrFormulaSyntaxEnum.crFormulaSyntaxCrystal;
 condFormula.Text = formulaText;
 printOutputController.SetPageMarginFormula(CrPageMarginConditionFormulaTypeEnum.crPageMarginConditionFormulaTypeLeft, condFormula);
}

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: Full-featured EPub generator