How to modified the report size by code?

peonestpeonest Junior Member
edited December 31, 1969 in Designing Analytics Reports
Hi dear all,

I have a question that how to modified the report size properties by code.
Need your help. Thanks!~

Comments

  • VirgilVirgil Administrator EM admin
    edited December 31, 1969
    Hi peonest,

    You can modify the master page properties in the beforeFactory event of the report with something like below.


    importPackage( Packages.org.eclipse.birt.report.model.api );
    importPackage(Packages.org.eclipse.birt.report.model.api.elements);
    importPackage(Packages.org.eclipse.birt.report.model.elements.interfaces);

    reportDesignHandle = reportContext.getReportRunnable().designHandle.getDesignHandle();
    masterPageHandle = reportDesignHandle.getMasterPages().get(0);

    masterPageHandle.setPageType(DesignChoiceConstants.PAGE_SIZE_CUSTOM);
    masterPageHandle.setProperty(IReportItemModel.HEIGHT_PROP, "9in");
    masterPageHandle.setProperty(IReportItemModel.WIDTH_PROP, "6in");

    Virgil Dodson
    OpenText Analytics Developer Community
    https://forums.opentext.com/forums/categories/analytics

  • peonestpeonest Junior Member
    edited December 31, 1969

    Hi peonest,



    You can modify the master page properties in the beforeFactory event of the report with something like below.





    importPackage( Packages.org.eclipse.birt.report.model.api );

    importPackage(Packages.org.eclipse.birt.report.model.api.elements);

    importPackage(Packages.org.eclipse.birt.report.model.elements.interfaces);



    reportDesignHandle = reportContext.getReportRunnable().designHandle.getDesignHandle();

    masterPageHandle = reportDesignHandle.getMasterPages().get(0);



    masterPageHandle.setPageType(DesignChoiceConstants.PAGE_SIZE_CUSTOM);

    masterPageHandle.setProperty(IReportItemModel.HEIGHT_PROP, "9in");

    masterPageHandle.setProperty(IReportItemModel.WIDTH_PROP, "6in");




    O, thanks very much!!~
  • peonestpeonest Junior Member
    edited December 31, 1969
    Hi vdodson,

    But I still have a question, do you know how to realize this in Java code instead of JavaScript? Thanks very much for you kindly help!~
  • VirgilVirgil Administrator EM admin
    edited December 31, 1969
    Hi peonest,



    I don't have an example, but a Google search revealed a Java class with an example at http://longlake.minnovent.com/repos/birt_example/birt_api_example/src/deapi/SalesReport.java

    Virgil Dodson
    OpenText Analytics Developer Community
    https://forums.opentext.com/forums/categories/analytics

  • peonestpeonest Junior Member
    edited December 31, 1969
    Hi Virgil~

    That's what i need exactly!!!! Thank you so much!!

    I'm starting to work on the reporting feature for a Tool development. May I have your e-mail address and make a friend with you?

    BTW, how can you get such amazing code in the internet by Google, while i couldn't, :)
  • VirgilVirgil Administrator EM admin
    edited December 31, 1969
    Hi peonest,



    You are welcome.



    My email and Yahoo IM info is available on my profile page at: http://www.birt-exchange.com/userinfo.php?cloned=no&uname=vdodson

    Virgil Dodson
    OpenText Analytics Developer Community
    https://forums.opentext.com/forums/categories/analytics

Sign In or Register to comment.