Home
Analytics
how to set value of a text control in master page during runtime in BIRT 232
yamanko
hi, guys, does anyone implement dynamically change a text control's value while this text control is contained in masterpage. i know i can do that by following way:
adding code like below in method initialize() of report
reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("TextControlNameinMasterpage").setContent("helloworld");
but this is not what i want, i need to change the control's value in runtime, in dataItem's onPageBreak and this dataItem is in report's body. i added same code in this DataItem's onPageBreak() method, but unfortunately fails.
do you have any suggestion or advice, thanks
Find more posts tagged with
Comments
yamanko
i write the control's content into a file and following are my code added into DataItem's onPageBreak()
var fstream = Packages.java.io.FileWriter("c:/test.txt",true);
var out = Packages.java.io.BufferedWriter(fstream);
out.write(reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("TextControlNameinMasterPage").getContent());
reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("column1").setContent("helloaaaaaaw");
out.write("rn");
out.write(reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("TextControlNameinMasterPage").getContent());
out.write("rn");
out.close();
i checked the content in test.txt and found that the original value of control 'TextControlNameinMasterPage' is 'test' (which i set when designing), and the modified value is 'helloaaaaaaw' which means i set this value successfully. but control'value in the output PDF is still 'test'
yamanko
it seems master page can not edited dynamically in run and render process. i can edit control in master page in DataItem's onPrepare(), but not in onCreate(), onRender() and onPageBreak().
even i put my code in group's onPageBreak(), i can still not modify the content of text object in master page.
so, is it possible to dynamically change text's content in master page, when group page breaks? or if there is no group and can i do that on detail's DataItem level