com.crystaldecisions.sdk.occa.report.document
Class PageMargins

java.lang.Object
  extended by com.crystaldecisions.sdk.occa.report.document.PageMargins
All Implemented Interfaces:
IPageMargins, IClone

public class PageMargins
extends java.lang.Object
implements IPageMargins, IClone

This object allows you to get and set the page margins of the report. This information includes: the top, bottom, left, and right margins of the report. These margins are absolute. The right margin is not relative to the left margin and the bottom margin is not relative to the top margin. All margins are measured in twips. Use IPageMargins to access these methods.


Constructor Summary
PageMargins()
           
PageMargins(IPageMargins src)
           
 
Method Summary
 java.lang.Object clone(boolean deepClone)
           
 void copyTo(java.lang.Object destObject, boolean deepCopy)
           
 java.lang.Object createMember(java.lang.String eleName, org.xml.sax.Attributes attrs, XMLSerializationContext ctxt, java.util.Map objState, boolean[] bLoaded)
           For internal use only.
 void endElement(java.lang.String eleName, java.util.Map objState)
           For internal use only.
 boolean getAdjustAutomatically()
          For internal use only
 int getBottom()
           Gets the bottom margin of the report.
 int getLeft()
           Gets the left margin of the report.
 PageMarginConditionFormulas getPageMarginConditionFormulas()
           Gets the page margin condition formulas of the report.
 int getRight()
           Gets the right margin of the report.
 int getTop()
           Gets the top margin of the report.
 boolean hasContent(java.lang.Object srcPageMargins)
           
 void readElement(java.lang.String eleName, java.lang.String sVal, org.xml.sax.Attributes attrs, java.util.Map objState)
           For internal use only.
 void save(XMLWriter writer, java.lang.String sTag, XMLSerializationContext ctxt)
           For internal use only.
 void save(XMLWriter writer, XMLSerializationContext ctxt)
           For internal use only.
 void saveContents(XMLWriter writer, XMLSerializationContext ctxt)
           For internal use only.
 void setAdjustAutomatically(boolean isAdjustAutomatically)
          For internal use only
 void setBottom(int bottom)
           Sets the bottom margin of the report.
 void setLeft(int left)
           Sets the left margin of the report.
 void setPageMarginConditionFormulas(PageMarginConditionFormulas newFormulas)
           Sets the page margin condition formulas of the report.
 void setRight(int right)
           Sets the right margin of the report.
 void setTop(int top)
           Sets the top margin of the report.
 void startElement(java.lang.String eleName, java.util.Map objState, org.xml.sax.Attributes attrs)
           For internal use only.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageMargins

public PageMargins(IPageMargins src)

PageMargins

public PageMargins()
Method Detail

clone

public java.lang.Object clone(boolean deepClone)

hasContent

public boolean hasContent(java.lang.Object srcPageMargins)

copyTo

public void copyTo(java.lang.Object destObject,
                   boolean deepCopy)

getTop

public int getTop()
Description copied from interface: IPageMargins

Gets the top margin of the report.

Specified by:
getTop in interface IPageMargins
Returns:
the top margin of the report

getBottom

public int getBottom()
Description copied from interface: IPageMargins

Gets the bottom margin of the report.

Specified by:
getBottom in interface IPageMargins
Returns:
the bottom margin of the report

getLeft

public int getLeft()
Description copied from interface: IPageMargins

Gets the left margin of the report.

Specified by:
getLeft in interface IPageMargins
Returns:
the left margin of the report

getRight

public int getRight()
Description copied from interface: IPageMargins

Gets the right margin of the report.

Specified by:
getRight in interface IPageMargins
Returns:
the right margin of the report

getPageMarginConditionFormulas

public PageMarginConditionFormulas getPageMarginConditionFormulas()
Description copied from interface: IPageMargins

Gets the page margin condition formulas of the report. This collection of condition formulas control the width of the page margins.

Specified by:
getPageMarginConditionFormulas in interface IPageMargins
Returns:
the PageMarginConditionFormulas stored with the report.

getAdjustAutomatically

public boolean getAdjustAutomatically()
Description copied from interface: IPageMargins
For internal use only

Specified by:
getAdjustAutomatically in interface IPageMargins

setTop

public void setTop(int top)
Description copied from interface: IPageMargins

Sets the top margin of the report.

Specified by:
setTop in interface IPageMargins
Parameters:
top - the top margin of the report

setBottom

public void setBottom(int bottom)
Description copied from interface: IPageMargins

Sets the bottom margin of the report.

Specified by:
setBottom in interface IPageMargins
Parameters:
bottom - the bottom margin of the report

setLeft

public void setLeft(int left)
Description copied from interface: IPageMargins

Sets the left margin of the report.

Specified by:
setLeft in interface IPageMargins
Parameters:
left - the left margin of the report

setRight

public void setRight(int right)
Description copied from interface: IPageMargins

Sets the right margin of the report.

Specified by:
setRight in interface IPageMargins
Parameters:
right - the right margin of the report

setPageMarginConditionFormulas

public void setPageMarginConditionFormulas(PageMarginConditionFormulas newFormulas)
Description copied from interface: IPageMargins

Sets the page margin condition formulas of the report. This collection of condition formulas control the width of the page margins.

Example:

This sample shows how to set a page margin condition formula. The formula 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. For more information on the syntax of conditional formulas please refer to Crystal Reports Online Help.

Use this method if you want to modify multiple print options in a report. For an alternate method see setPageMarginFormula.

 PrintOutputController printOutputController = clientDoc.getPrintOutputController();
 IPrintOptions printOptions = printOutputController.getPrintOptions();
 IPrintOptions newPrintOptions = (PrintOptions)((PrintOptions)printOptions).clone(true);
 IPageMargins newMargins = newPrintOptions.getPageMargins();
 PageMarginConditionFormulas formulas = new PageMarginConditionFormulas();
 IConditionFormula condFormula = new ConditionFormula();
 String formulaText = "If Remainder(pagenumber,2) = 0 then 1440 else 2880";
 condFormula.setSyntax(FormulaSyntax.crystal);
 condFormula.setText(formulaText);
 formulas.setFormula(PageMarginConditionFormulaType.left, condFormula);
 newMargins.setPageMarginConditionFormulas(formulas);
 newPrintOptions.setPageMargins(newMargins);
 printOutputController.modifyPrintOptions(newPrintOptions);
 

Note: There are 1440 twips in an inch.

Specified by:
setPageMarginConditionFormulas in interface IPageMargins

setAdjustAutomatically

public void setAdjustAutomatically(boolean isAdjustAutomatically)
Description copied from interface: IPageMargins
For internal use only

Specified by:
setAdjustAutomatically in interface IPageMargins

readElement

public void readElement(java.lang.String eleName,
                        java.lang.String sVal,
                        org.xml.sax.Attributes attrs,
                        java.util.Map objState)

For internal use only.


save

public void save(XMLWriter writer,
                 XMLSerializationContext ctxt)
          throws java.io.IOException

For internal use only.

Throws:
java.io.IOException

save

public void save(XMLWriter writer,
                 java.lang.String sTag,
                 XMLSerializationContext ctxt)
          throws java.io.IOException

For internal use only.

Throws:
java.io.IOException

saveContents

public void saveContents(XMLWriter writer,
                         XMLSerializationContext ctxt)
                  throws java.io.IOException

For internal use only.

Throws:
java.io.IOException

createMember

public java.lang.Object createMember(java.lang.String eleName,
                                     org.xml.sax.Attributes attrs,
                                     XMLSerializationContext ctxt,
                                     java.util.Map objState,
                                     boolean[] bLoaded)

For internal use only.


endElement

public void endElement(java.lang.String eleName,
                       java.util.Map objState)

For internal use only.


startElement

public void startElement(java.lang.String eleName,
                         java.util.Map objState,
                         org.xml.sax.Attributes attrs)

For internal use only.