I use the class definition template for testing. The code is as follows:
@Component(TestReport.NAME)
public class TestReport implements CustomReport {
public static final String NAME = “cubahrp_TestReport”;
@Override
public byte[] createReport(Report report, BandData rootBand, Map<String, Object> params) {
if(!(report instanceof com.haulmont.reports.entity.Report)){
return new byte[0];
}
com.haulmont.reports.entity.ReportTemplate reportTemplate = ((com.haulmont.reports.entity.Report) report).getDefaultTemplate();
byte[] templateByte = reportTemplate.getContent();
return templateByte;
}
}
I found that the custom returned template file did not fill in the data after run report.
I think it’s a BUG.
I’m sorry for my poor English. I hope it won’t affect your understanding.
I tracked the code and found that the class definition template did not actually perform data filling operations. I think it should be renamed as a custom report rather than a class definition template.
I hope to dynamically modify the word template through code before filling in the report data. I wonder if there are any other solutions?
Thanks!
hi,Daniil
thank you for your reply.
I am just borrowed the method of creating beans to create classes in the core module, and I have defined FQA in the template. As shown in the figure:
My problem is that I want to be able to dynamically modify template content through code before YARG fills in data.
But now, with Class-Defined Template, YARG is no longer filling in data.