Do you want to: Report a bug
problem:
When using oDocument.ToJSON in a document that has the current document page counter, the generated json is bogus.
It is something like:
{type: 'instrText', hOh: 'PAGE'}
instead of:
{type: 'instrText', instr: 'PAGE'}
And therefore, using the generated JSON is creates an error.
You can reproduce the problem using
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddPagesCount();
let json = oDocument.ToJSON(false, false, false, false, false, false);
console.log(JSON.parse(json))
var api_json = Api.FromJSON(json)
To resolve the problem, i modified the function “WriterToJSON.prototype.SerParaRun” in file “sdkjs/word/fromToJSON.js”
where the line :
oInstrText.instr = "PAGE";
should be :
oInstrText["instr"] = "PAGE";
The problem cames only after the code has been minificated
Best,
DocumentBuilder version: 7.4 , 7.5
OS: ubuntu / docker