I have been working on a pair of macros to try to get around the current weakness (failure) of Report Builder to generate Charts in Base Reports, for SQL databases in particular. I prefer to embed charts in Reports, rather than in Forms, because it is so much easier to add commentary and description to reports intended for printing:
A) Create (or re-create) a Chart report in Report Builder. To allow quick regeneration of Chart reports each time LO is upgraded - and Base chart reports get broken.
The attached Base file testodb0.odb uses built-in HSQLDB and includes two reports:
- āSales_Reportā created in Report Builder.
- āSales_Report_by_codeā created by running macro āSales_Report_ORBā in module āSales_Report_ORBā - or use custom menu ReportMacros (to the right of Help).
The āSales_Report_ORBā macro fails to include the horizontal line (actually a thin Rectangle shape) in the Page Header. Does anyone have any ideas on why not?
Apart from this, the two reports look identical when inspected in Report Builder but both suffer the same fate when executed (in LO v5.3.6.1 colours revert to defaults, in LO v6.0.1.1 the Chart does not appear). So this would seem to be a dead end - unless other people have a different experience?
B) Create a Base report directly in Writer, bypassing Report Builder and its integration into LO. To be more resilient against LO upgrades, but report changes will have to be done in code - which can be tedious.
Execute macro macro āSales_Report_Writerā in module āSales_Report_Writerā - or use custom menu ReportMacros (to the right of Help). This works well in both LO v5.3.6.1 and LO v6.0.1.1 (TDF builds under OpenSuse Linux x64). Iād be interested to hear how well it works in other versions of LO?
These macros explore many elements of a chart and of report generation which I hope may be of interest to macro coders. Chart type in these macros is a simple Pie Chart, but I also have a Stacked Area report and a grouped XY chart report which I hope to be able to post soon.
I have learnt much from other contributors whom I would like to acknowledge, including ratslinger, Villeroy, longi, Robert GroĆkopf.