### Advanced Page Report Studio API application

Besides fundamental functions that Page Report Studio API provides, you can further obtain other instances from DHTMLClientService.

#### How to get the other instances

    //Get a Page Report Studio API instance using the method 1 or
    //2 provided in the preceding section, and then
    //use the following method to get the other instances.

    //The instance "service" is supposed to be derived
    //from the above method 1 or 2.

     DHTMLConfig config = service.getDHTMLConfig();
     DHTMLDataInfo dataInfo = service.getDHTMLDataInfo();
     DHTMLWriter writer = service.getDHTMLWriter(sessionId, rptSetId)

#### How to use the other instances

Customizing Page Report Studio toolbar using the Page Report Studio API

Page Report Studio API provides you with the Page Report Studio interface. With the Page Report Studio API, you can easily embed the Page Report Studio page or components into your own JSP. Here jet.web.dhtml.DHTMLConfig is used to customize your own Page Report Studio toolbar.

- Method: jet.web.dhtml.DHTMLConfig.customizeToolbar (java.lang.String sessionId, java.lang.String rptSetId, java.lang.String toolbarname, int[] buttonId, boolean isVisible)

  This method is used to specify the buttons displayed on the Page Report Studio toolbar.

  Parameters:

  - sessionId
    The session ID of the current user or current request.
  - rptSetId
    The report ID of the current user or current request.
  - toolbarname
    Name of the toolbar, such as "Standard", "View", "Analysis", and user-defined ones.
  - buttonId
    The buttonId constant for the toolbar. The buttonId argument is an integer bitmask that can be
    DHTMLConstant.TOOLBAR_UNDO, DHTMLConstant.TOOLBAR_REDO, DHTMLConstant.TOOLBAR_SEARCH, DHTMLConstant.TOOLBAR_PREVIOUS_SEARCH, DHTMLConstant.TOOLBAR_NEXT_SEARCH, DHTMLConstant.TOOLBAR_EXPORTTOHTML, DHTMLConstant.TOOLBAR_EXPORTTOPDF, DHTMLConstant.TOOLBAR_EXPORTTOXML, DHTMLConstant.TOOLBAR_EXPORTTORTF, DHTMLConstant.TOOLBAR_EXPORTTOXLS, DHTMLConstant.TOOLBAR_EXPORTTOTEXT, DHTMLConstant.TOOLBAR_EXPORTTOPS, and so on, or a bitwise union of them (for example, DHTMLConstant.TOOLBAR_UNDO | DHTMLConstant.TOOLBAR_REDO).
  - isVisible
    If it is true, the buttons are visible.
- Method: jet.web.dhtml.DHTMLConfig.setUsedToolbar (java.lang.String sessionId, java.lang.String rptSetId, java.lang.String rptName, java.lang.String toolbarName, boolean isShow)

  This method is used to set the toolbar's default status: shown or hidden.

  Parameters:

  - sessionId
    The session ID of the current user or current request.
  - rptSetId
    The report ID of the current user or current request.
  - rptName
    The report name of the current user or current request.
  - toolbarname
    Name of the toolbar, such as "Standard", "View", "Analysis", and user-defined ones.
  - isShow
    If it is true, the toolbar is visible.

To customize the Page Report Studio toolbar, you must add the following code to run_report.jsp in `<intall_root>\public_html\dhtmljsp`. And this code must be after the RunReport() method.

    DHTMLClientService service = DHTMLServiceFactory.getDHTMLClientService(request);
    DHTMLConfig	dhtmlConfig = service.getDHTMLConfig();
    String SessionID = DHTMLUtil.getSessionID(request);
    String RptSetId = DHTMLUtil.getRptSetId(request);
    int[] bId = new int[]{DHTMLConstant.TOOLBAR_EXPORTTOPDF,DHTMLConstant.TOOLBAR_EXPORTTOXML,DHTMLConstant.TOOLBAR_SEARCH};
    dhtmlConfig.customizeToolbar(SessionID, RptSetId, "View", bId, true);
    dhtmlConfig.setUsedToolbar(SessionID, RptSetId, null, "View", true);

Reference: For more information on this topic, see the JReport Javadoc located in `<install_root>\help\api`.