### Advanced DHTML API application

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

#### How to get the other instances

    //Get a DHTML 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 DHTML toolbar using the DHTML API

DHTML API provides you with the API interface. With the DHTML API, you can easily embed the DHTML page or components into your own JSP. Here jet.web.dhtml.DHTMLConfig is used to customize your own DHTML 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 DHTML toolbar.

  Parameters:

  - sessionId
    The session id of the current user or current request.
  - rptSetId
    The report set 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 etc., 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 set 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 DHTML 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 Javadoc located in `<install_root>\help\server\en\api`.