Report Generator with Word Rich Text Format keeps producing XML parsing error
2 views (last 30 days)
Show older comments
I've got a script that opens a word template (dotx) with RTF and goes from hole to hole appendeding data to the holes. (Same workflow as in the introduction video for the report generator: https://www.mathworks.com/videos/introduction-to-matlab-report-generator-1530193853139.html)
It worked fine at first, but after a while I would try to open the docx file that it would produce and I would get an XML parsing error. (/word/document.xml, line: 2 column:65806)
In general, my code looks like this:
import mlreportgen.dom.*
run DataImport.m
rpt = Document('Report','docx','ReportTemplate.dotx');
open(rpt)
moveToNextHole(rpt);
append(rpt, data1);
moveToNextHole(rpt);
append(rpt, data2);
%This goes on for several pages
close(rpt)
My big question is whether this is a problem with my code or the word template. I found that if I shortened my code (closed rpt say, before appending data2) it would open just fine (but of course the report is not finished). I tried running the docx file through Yodot doc repair and that didn't do anything.
3 Comments
Answers (0)
See Also
Categories
Find more on Templates in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!