Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
set width of report in java
veet
<p>Hi,</p><p>can you help me, how can I set width of my report in java?</p><p>It would be possible to show some example?</p><p>Thanks to everybody.</p>
Find more posts tagged with
Comments
johnw
<p>With your ReportDesignHandle, you will get the Master Page, then set the type to custom, and the width/height. The following is a JavaScript example that gets the design handle, but it will be the same in Java.</p><p> </p><div><pre class="_prettyXprint">reportContext.getDesignHandle().getMasterPages().get(0).setProperty("type", "custom");reportContext.getDesignHandle().getMasterPages().get(0).setProperty("height", "200px");reportContext.getDesignHandle().getMasterPages().get(0).setProperty("width", "200px");</pre></div>
veet
<p>Hi,</p><p>thanks for answer.
I try this:
IReportDocument repdoc = engine.openReportDocument(fileName + ".rptdocument");
repdoc.getReportDesign().getMasterPages().get(0).setProperty("type", "custom");
repdoc.getReportDesign().getMasterPages().get(0).setProperty("height", "200px");
repdoc.getReportDesign().getMasterPages().get(0).setProperty("width", "200px");
But it do not work.
It seems that:
repdoc.getReportDesign().getMasterPages().get(0).setProperty("type", "custom");
do not set property with name "type" and value "custom"
And when I try to set height It shows this error:
<a data-ipb='nomediaparse' href='
http://org.eclipse.birt.report.model.api.elements.SemanticError'>org.eclipse.birt.report.model.api.elements.SemanticError</a>
: The master page "Simple Master Page("Simple MasterPage")" cannot specify size since the page type is not custom.
at <a data-ipb='nomediaparse' href=''>org.eclipse.birt.report.model.command.PropertyCommand.setProperty(PropertyCommand.java:249</a>)
at <a data-ipb='nomediaparse' href=''>org.eclipse.birt.report.model.command.PropertyCommand.setProperty(PropertyCommand.java:148</a>)
at <a data-ipb='nomediaparse' href=''>org.eclipse.birt.report.model.api.DesignElementHandle.setProperty(DesignElementHandle.java:520</a>)
When I loook what properties are in document
i can see, that one property with name "type" has still defaultValue="us-letter".
It seems that:
repdoc.getReportDesign().getMasterPages().get(0).setProperty("type", "custom");
do not work.</p><p> </p><p>Please, can you help me?</p>
johnw
<p>IReportDocument won't have that. A Report document has already been run. So setting the properties of the report design from a report document would be going backwards.</p>
veet
<p>So where can I set the property? I should set it in instance engine?</p>
johnw
<p>IReportDesignHandle. This is what should be passed to your IRunTask initially.</p>
veet
<p>Thank. It works.</p><p>And it changes size of the master page. Is there any way how to change width and height of all elements(table, chart, ...) in report?</p><p>I <span><span>thought, that I change size of the master page end these element change its size too. But t</span></span>hese elements do not change width and height with the masterpage.</p>