User`s guide
13 Create a Report Program
13-90
import mlreportgen.dom.*
d = Document('MyReport','docx','MyReportTemplate');
for rank = 3:5
chapterPart = DocumentPart(d,'Chapter');
while ~strcmp(chapterPart.CurrentHoleId,'#end#')
switch chapterPart.CurrentHoleId
case 'ChapterTitle'
append(chapterPart, ...
sprintf('Rank %i Magic Square',rank));
case 'ChapterContent'
table = append(chapterPart,magic(rank));
table.Width = '2in';
end
moveToNextHole(chapterPart);
end
append(d, chapterPart);
end
close(d);
rptview(d.OutputPath);
You can use a similar approach to automatically number HTML reports, using the CSS
counter-increment and content properties in the template for your report.
See Also
Functions
mlreportgen.dom.Document.createAutoNumberStream |
mlreportgen.dom.Document.getAutoNumberStream
Classes
mlreportgen.dom.AutoNumber | mlreportgen.dom.AutoNumberStream |
mlreportgen.dom.CounterInc | mlreportgen.dom.CounterReset