Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
set Title for PDF metadata
Senro
<p>Hi together,</p>
<p> </p>
<p>first sorry for my poor english.</p>
<p> </p>
<p>Ok, i have a report with a report item (label). The text in this label is hardcoding and also the title of this report. I want to read this text and set it to the advanced properties as title by java. The problem is, that i only can set the title in the initialize method, but at this time the report item is not created. The result is a nullpointer. There must be a way to resolve this problem. Please help me, i have a bunch of reports with this problem.</p>
<p>My java class extends ReportEventAdapter and the method work with "reportContext.getDesignHandle().setProperty("title", title);" So what can be done to get the value of the label at the initialize? Or can i set the title later in the generation phase or presentation phase?</p>
<p> </p>
<p>Thanks a lot</p>
<p> </p>
Find more posts tagged with
Comments
mwilliams
<p>If the text in the label is static, as you said, you could do something like this, where "MyLabel" is the name set for your label in the property editor:</p>
<p> </p>
<p>var myTitle = reportContext.getDesignHandle().findElement("MyLabel").getStringProperty("text");</p>
<p> </p>
<p>This works in the initialize method.</p>
Senro
<p>Hi Michael,</p>
<p> </p>
<p>thanks for your answer!</p>
<p>With a little modification this works for my issue.</p>
<p> </p>
<p>Below i post my solution to work with a ReportEventHandler:</p>
<pre class="_prettyXprint">
@Override
public void initialize(IReportContext reportContext) throws ScriptException {
// TODO Auto-generated method stub
super.initialize(reportContext);
String myTitle = reportContext.getDesignHandle().findElement("title").getStringProperty("text");
try {
reportContext.getDesignHandle().setProperty("title", myTitle);
} catch (SemanticException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}</pre>
<p><span><span>many</span> <span>thanks for</span> <span>your help</span></span> and have a nice day!</p>
<p>Senro</p>
mwilliams
<p>Wonderful. Glad I could help. Let us know whenever you have questions.
</p>