Report Generator with Word Rich Text Format keeps producing XML parsing error

2 Ansichten (letzte 30 Tage)
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 Kommentare
Jackson Seymore
Jackson Seymore am 22 Feb. 2021
The error I get is:
Could not open file "AQM\Data\AQM_Report.docx"
Invoke Error, Dispatch Exception:
Source: Microsoft Word
Description: Word encountered an error processing the XML file AQM_Report
Unspecified error
Location: Part: /word/document.xml, Line: 0, Column: 0
Help File: wdmain11.chm
Help Context ID: 63ee
hDoc = locOpenDoc(fileName);
locRunWordCommands(fullFileName,varargin{:});
rptgen.docview(fullFileName,'updatedocxfields');
Error in rptview (line 22)
rptgen.rptview(fileName, varargin{:})
Jackson Seymore
Jackson Seymore am 22 Feb. 2021
I noticed that the problem occurs after a block hole while everything else up to it has been an inline hole

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte


Version

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by