documentbuilder run fail
verydemo opened this issue · comments
xiaozhang commented
documentbuilder add_content_control.docbuilder
add_content_control.docbuilder:
builder.OpenFile("./src_sdt.docx")
var oDocument = Api.GetDocument();
var oRange = oDocument.GetRange(0);
var arrParagraphs = oRange.GetAllParagraphs();
console.log(arrParagraphs.length)
try {
var arrParagraphs = oRange.GetAllParagraphs();
console.log(arrParagraphs.length)
for (var i = 0; i < arrParagraphs.length; i++) {
var oParagraph = arrParagraphs[i];
if (oParagraph.GetClassType() == "paragraph") {
// add ContentControl
// if (i >=0 && i<=20000) // fine
// if (i >=20000 && i<=32000) // fine
// if (i >=20000 && i<=30000) // fine
// if (i >=21000 && i<=32000) // fine
// if (i >=10000 && i<=32000) // fine
// if (i >=0 && i<=32000) // error
// if (i >=0 && i<=30000) // error
// if (i >=0 && i<=28000) // error
if (i >=0 && i<=25000) //error
{
oBlockLvlSdt = oParagraph.InsertInContentControl(1);
oBlockLvlSdt.SetLock(3);
oBlockLvlSdt.SetTag(Math.random().toString(36).substring(7));
}
}
}
}
catch (error) {
console.log("error", error);
}
builder.SaveFile("docx", "dst_add_sdt.docx");
builder.CloseFile();
arrParagraphs.length=31928
I guess it's because there are run too many function InsertInContentControl.
error info:
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x76627d28969 <JSObject>
1: new cf [0x19ae0a882311 <undefined>:~11792] [pc=0x17099f553125](this=0x3563f1d2ec31 <cf map = 0x62b5010bc01>,b=0xfdea55e5f29 <JSObject>,e=0x19cfc0c88779 <fh map = 0x62b5015bf39>,x=0x19ae0a882421 <false>)
3: /* anonymous */ [0x19ae0a882311 <undefined>:~20688] [pc=0x17099f619f3b](this=0x19cfc0c88779 <fh map = 0x62b5015bf39>,b=0,e=1,x=0x19ae0a882311 <undefined>)
4: /* anonymous */ [0x1...
#
# Fatal javascript OOM in CALL_AND_RETRY_LAST
#
Received signal 4 ILL_ILLOPN 7f6d8ef8a4e9
==== C stack trace ===============================
[0x7f6d8ef8b732]
[0x7f6d8e423210]
[0x7f6d8ef8a4e9]
[0x7f6d8e7a5f7d]
[0x7f6d8e7a617c]
[0x7f6d8e97365f]
[0x7f6d8eee977c]
[0x17099f3046fd]
[end of stack trace]
Illegal instruction
Pavel Lobashov commented
Pavel Lobashov commented
This issue was closed due to no response.