I have coded a custom statement generation program and I am using the HTML report template to generate a cover note. I would like to allow the user to create their own HTML template but do not want to allow them to use the Report Manager screens (too many fields, controls). By selecting the Report entity and the default report template, I can query out the HTML content in the template, edit it and then save it back into the Report Template entity. This works.
But when try to use my screen to create a new Report entity and template, I create the Report Entity, ReportTemplate entity and BandDefinitions and save it. It shows up in Report Manager but this report cannot is be used. When I edit the new report in Report manager, the Root band is missing.
Is there an API, a service or a correct way to create a new Report in my program ?
As far as I know, there is no programmatic API to create Report entities.
You can compare your data structure with the structure which is formed in the ReportEditor, just before saving the report to database.
E.g. put a breakpoint here: com.haulmont.reports.gui.report.edit.ReportEditor#preCommit
and look in the debugger how the report stored in the getItem() looks like.
Maybe you are missing this code from the com.haulmont.reports.gui.report.edit.ReportEditor#addCommitListeners?
String xml = reportService.convertToString(getItem());
getItem().setXml(xml);