How to use builder object in plugins?
I want to use a plugin to insert the contents of other files into the currently open document.
So, I write code below and get an error.
builder.OpenFile("http://ip:port/example/download?fileName=new.docx");
var oDocument = Api.GetDocument();
var oContent = oDocument.GetContent();
GlobalVariable["1"] = oContent
builder.CloseFile();
// in editor, The opened file you want to insert content into
var text = GlobalVariable["1"];
var oDoc = Api.GetDocument();
var oP = oDoc.GetElement(0);
oP.AddText("Data from other file: " + text);
In general, I’d ask you to provide more details about the plugin you are developing. Main question here is where the source file from which content you want to copy is located? In the same storage or somewhere else?
Also, specify step-by-step scenario of what you want your plugin to perform.
Thanks.
Firstly, somewhere on the internet (URL), I have some Word documents.
The user opens the main document and opens the plugin interface I wrote. By clicking the button, the remote Word document content is inserted into the currently open document.
I open the document, not only to edit it, but more importantly, to merge the existing Word document content into the current file.
Thanks.
Firstly, somewhere on the internet (URL), I have some Word documents.
The user opens the main document and opens the plugin interface I wrote. By clicking the button, the remote Word document content is inserted into the currently open document.
I open the document, not only to edit it, but more importantly, to merge the existing Word document content into the current file.
In general, for this scenario you can use Content Controls. If your source document has all text inside a rich-text Content Control, you can fetch content from it and paste to the current document with method InsertAndReplaceContentControls.
Is there a way to append multiple documents to a content control? I have multiple URLs and I want to insert them one after the other dynamically in the same content control
This however won’t work if I want to append another document right after it. Calling InsertAndReplaceContentControls on the same InternalId will overwrite the content control’s content with the new document.
I don’t have the content of the remote documents in the user’s clipboard. I only have the URLs. Pasting the text inside the content controls won’t solve this problem.
Hello @fr3fou
Please do not post similar questions in the different threads. As far as I understand, you are checking the possibility of appending content control to another one: Append content at the end of a Content Control
We are checking mentioned scenario, I’m closing this thread as duplicate.