com.crystaldecisions.sdk.occa.report.application
Class ReportObjectController

java.lang.Object
  extended by com.crystaldecisions.sdk.occa.report.application.ReportObjectController

public class ReportObjectController
extends java.lang.Object

This object is used to add, remove, and modify the report objects that are defined in the definition package. These objects include charts, pictures, lines, text objects, and field objects. Report objects are contained within a section of the report, and each section belongs to a particular report area.

To access a report object


Method Summary
 void add(IFieldObject fieldObject, java.lang.String headingText)
          Adds a Field object to details section and adds a FieldHeadingObject object to the page header section if headingText is not empty and not null.
 void add(IReportObject object, ISection section, int index)
           Adds a report object to a specified section of the report.
 void add(java.lang.String fieldName)
           Adds a Field object to details section.
 void add(java.lang.String fieldName, java.lang.String headingText)
           Adds a Field object to details section and adds a FieldHeadingObject object to the page header section if headingText is not empty or not null.
 boolean canAddReportObject(IReportObject object, ISection section)
          For internal use only.
 boolean canEmbedFieldIntoTextObject(java.lang.String formulaForm, ITextObject textObject)
          For internal use only.
 ReportObjects getAllReportObjects()
           Gets a collection of all the report objects in the report.
 ChartObjectController getChartObjectController()
          For internal use only.
 CrossTabObjectController getCrossTabObjectController()
          For internal use only.
 ReportObjects getReportObjectsByKind(ReportObjectKind objectKind)
           Gets a collection of all the report objects of the specific kind in the report.
 PictureObject importPicture(java.lang.String pictureFilePath, ISection section, int left, int top)
           Imports an image file into the report as a Picture object.
 void modify(IReportObject oldObject, IReportObject newObject)
           Modifies a report object.
 void move(IDrawingObject object, ISection newSection, int top, int left, ISection endSection, int bottom, int right)
          Moves a drawing object to a new position in the report.
 void move(IReportObject object, ISection newSection, int top, int left)
          Moves a report object to a specified section and position within the section.
 void remove(IReportObject object)
           Removes a report object from the report.
 void reorder(IReportObject rptObj, int toIndex)
          For internal use only.
 void validateReportObject(IReportObject object)
          For internal use only.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

canAddReportObject

public boolean canAddReportObject(IReportObject object,
                                  ISection section)
For internal use only.


canEmbedFieldIntoTextObject

public boolean canEmbedFieldIntoTextObject(java.lang.String formulaForm,
                                           ITextObject textObject)
For internal use only.


add

public void add(IReportObject object,
                ISection section,
                int index)
         throws ReportSDKException

Adds a report object to a specified section of the report. The collection of report objects can be accessed by using the getReportObjects method in the Section object. The index is zero-based.

Parameters:
object - The report object that you want to add to the report.
section - The section of the report in which the object will appear.
index - The position in the ReportObjects collection where you want to add the object. Specify -1 to add the object to the end of the array. The index is zero-based.
Throws:
ReportSDKException

modify

public void modify(IReportObject oldObject,
                   IReportObject newObject)
            throws ReportSDKException

Modifies a report object. The collection of report objects can be accessed by using the getReportObjects method in the Section object. The index is zero-based.

Parameters:
oldObject - The report object to be modified in the collection.
newObject - The new report object.
Throws:
ReportSDKException

remove

public void remove(IReportObject object)
            throws ReportSDKException

Removes a report object from the report.

Note:When you remove a SummaryField, the Filters and Sorts associated with this SummaryField will also be removed.

Parameters:
object - The ReportObject to be removed.
Throws:
ReportSDKException

getAllReportObjects

public ReportObjects getAllReportObjects()

Gets a collection of all the report objects in the report.

Example:

This sample shows how to retrieve a collection of all the ReportObjects in a Crystal report. Report objects are the visible entities that define a report, such as charts, pictures and hyperlinks. Report Objects store information about the object's size, position, border, and color.

 ReportDefController reportDefController = clientDoc.getReportDefController();
 ReportObjectController reportObjectController = reportDefController.getReportObjectController();
 ReportObjects reportObjects = reportObjectController.getAllReportObects();
 

Returns:
ReportObjects a reference to a ReportObjects collection

getReportObjectsByKind

public ReportObjects getReportObjectsByKind(ReportObjectKind objectKind)

Gets a collection of all the report objects of the specific kind in the report.

Example:

This sample shows how to retrieve a collection of all the ReportObjects in a Crystal report of a specified kind. Report objects are the text objects, charts, pictures, bitmaps and so on that appear in reports. Report objects store information about the object's size, position, border, and color.

 ReportDefController reportDefController = clientDoc.getReportDefController();
 ReportObject reportObjectController = reportDefController.getReportObjectController();
 ReportObjects reportObjects = reportObjectController.getReportObectsByKind(ReportObjectKind.field);
 

Parameters:
objectKind - the ReportObjectKind of objects to return
Returns:
ReportObjects a reference to a ReportObjects collection
See Also:
ReportObjectKind

add

public void add(java.lang.String fieldName)
         throws ReportSDKException

Adds a Field object to details section.

Parameters:
fieldName - the name of the field object to add to the details section
Throws:
ReportSDKException

add

public void add(java.lang.String fieldName,
                java.lang.String headingText)
         throws ReportSDKException

Adds a Field object to details section and adds a FieldHeadingObject object to the page header section if headingText is not empty or not null.

Note: The field added to the detail section with this method must be a DB field, parameter field, formula field, runningtotal field, or SQL expression field.

Example:

This sample shows how to add a report object to a specified section of the report. Report objects can be charts, pictures, lines, text objects, and field objects. Report objects are contained within a section of the report, and each section belongs to a particular report area. An area is a group of like sections in the report that all share the same characteristics. You will add a field to the PageHeaderArea of the report.

 ReportDefController reportDefController = clientDoc.getReportDefController();
 ReportObjectController reportObjectController = reportDefController.getReportObjectController();
 reportObjectController.add( "{Table.Field}", "FieldName" );
 

Parameters:
fieldName - the name of the field object to add to the details section. The name must be in formula form.
headingText - the name of the FieldHeadingObject that you want to add to the page header section, when headingText is not null or empty. This parameter is optional. The default value is empty.
Throws:
ReportSDKException

add

public void add(IFieldObject fieldObject,
                java.lang.String headingText)
         throws ReportSDKException

Adds a Field object to details section and adds a FieldHeadingObject object to the page header section if headingText is not empty and not null.

Note: The field added to the detail section with this method must be a DB field, parameter field, formula field, runningtotal field, or SQL expression field.

Parameters:
fieldObject - the field object to be added to the details section.
headingText - the name of the FieldHeadingObject that you want to add to the page header section, when headingText is not null or empty. This parameter is optional. The default value is empty.
Throws:
ReportSDKException

importPicture

public PictureObject importPicture(java.lang.String pictureFilePath,
                                   ISection section,
                                   int left,
                                   int top)
                            throws ReportSDKException

Imports an image file into the report as a Picture object.

Use this method to import an image into the report as a PictureObject. If you want to replace an image that you have imported using this method, or if you want to replace an image that you have imported using the Graphic Location feature in the Report designer, first use the remove(IReportObject) method to remove the image and then use this method to import the replacement image. Do not use the modify(IReportObject, IReportObject) method to replace the image.

Parameters:
pictureFilePath - The file path to the image relative to the location of the RAS server. The SDK must have access rights to the image file. Forward relative paths are acceptable. For example, \images\myphoto.jpg is acceptable but ..\images\myphoto.jpg is not. HTTP paths are acceptable. FTP requests are not available. Only mapped file server locations are considered valid.
section - The section of the report in which the object will appear.
left - The position of the Picture object relative to the left of the section.
top - The position of the Picture object relative to the top of the section.
Returns:
a new picture
Throws:
ReportSDKException

move

public void move(IReportObject object,
                 ISection newSection,
                 int top,
                 int left)
          throws ReportSDKException
Moves a report object to a specified section and position within the section.

Note: This method cannot be used to move drawing objects. To move an IDrawingObject , use move(IDrawingObject,...).

Parameters:
object - the IReportObject to move (must not be an IDrawingObject)
newSection - the ISection to move the report object to
top - the distance from the top of the section at which to place the report object
left - the distance from the left of the section at which to place the report object
Throws:
ReportSDKException

move

public void move(IDrawingObject object,
                 ISection newSection,
                 int top,
                 int left,
                 ISection endSection,
                 int bottom,
                 int right)
          throws ReportSDKException
Moves a drawing object to a new position in the report. The new position and size of the drawing object are specified by a start and end section, the position of the top-left corner of the drawing object within the start section, and the position of the bottom-right corner of the drawing object within the end section.

Parameters:
object - the IDrawingObject to move
newSection - the ISection to move the report object to
top - the distance from the top edge of the section at which to place the report object
left - the distance from the left edge of the section at which to place the report object
endSection - the end ISection where the bottom-right corner of the drawing object will be positioned
bottom - the distance from the bottom edge of the endSection of the drawing object's bottom-right corner
right - the distance from the right edge of the endSection of the drawing object's bottom-right corner
Throws:
ReportSDKException

reorder

public void reorder(IReportObject rptObj,
                    int toIndex)
             throws ReportSDKException
For internal use only.

Throws:
ReportSDKException

getCrossTabObjectController

public CrossTabObjectController getCrossTabObjectController()
For internal use only.


getChartObjectController

public ChartObjectController getChartObjectController()
For internal use only.


validateReportObject

public void validateReportObject(IReportObject object)
                          throws ReportSDKException
For internal use only.

Throws:
ReportSDKException