To generate a report from a DOM-based document object:
- Derive your report class from mlreportgen.dom.Document class, for example
class MyReport < mlreportgen.dom.Document
method
function rpt = MyReport(name)
rpt@mlreportgen.dom.Document(name, 'docx', 'MyTemplate');
end
end
end
- Provide a public fill<HOLEID> method for each hole in your report template, where HOLEID is the name of the hole, for example,
class MyReport < mlreportgen.dom.Document
method
function rpt = MyReport(name)
rpt@mlreportgen.dom.Document(name, 'docx', 'MyTemplate');
end
function fillReportDate(rpt)
append(rpt, date);
end
end
end
- Create a report program (i.e., script or function) to run the report.
- In the report program, create an instance of your report class and call its fill method (inherited from mlreportgen.dom.Document class), for example,
rpt = MyReport('myreport');
fill(rpt);
rptview(rpt.OutputPath);
Best Answer