Issue Inserting DOCXF content into another DOCXF document

Hi there,

I am trying to get content from one document and insert into another document (DOCXF) but I am having trouble when using GlobalVariable with oDocument.GetElement(i).Copy() as it crashes the document builder.

shell-issue

I was able to use ToJSON and FromJSON, however, all the form fields were transformed into shapes and I couldn’t get them to be fillable.

Code Snippet:

builder.OpenFile("C:path/to/test_standard.docxf", "");
 
var template = [];
var document = Api.GetDocument(); // get current document
var n = document.GetElementsCount();

for (var i = 0; i < n; i++) {
    var element = document.GetElement(i);

    template.push(element.Copy());

};
GlobalVariable["template"] = template;
builder.CloseFile();
builder.OpenFile("path/to/test_template.docxf", "");

var oDocument = Api.GetDocument();
var oParagraph = Api.CreateParagraph();
var template = GlobalVariable["template"];

var clone = []; // start the cloned page
for (var i = 0; i < template.length; i++) {

    clone.push(template[i].Copy()); // copy each element of the template
};
oDocument.InsertContent(clone); // apend the cloned content

builder.SaveFile("docxf", "path/to/test_530.docxf"); 
builder.CloseFile();

I need help getting through this.

Kind Regards,

Diogo.

Hello @diogo151
Please clarify your Document builder version and attach the original file from your test, we will check it out.

Hi @Alexandre,

Thanks for getting back to me.

Document builder version: v8.0.0.99
sdk version: 8.0.0 (build:99)

test_template.docxf (171.5 KB)

test_standard.docxf (84.5 KB)

Let me know if you need anything else.

Regards,

Diogo.

Hello @diogo151
Thank you, we are checking the situation. I will update this thread when we have something to share.

Hello @diogo151
Sorry for the late reply. Unfortunately, there’s no way to achieve desired result at the moment. However, we have started working on the implementation of necessary methods. Right now I cannot provide you with exact ETA, but I will update this thread when we have something to share.