How to insert an object into a word document with go

I hope to insert an embedded object(another .docx file) into a .docx file. Is there any package that support this?

@catacombs, thank you for your reply!
Yes, the request from my manager is to insert one docx file into another docx file. Since we did this way manually before, now we hope to automate the same process. Do you have any idea?

I didn’t tried but at first sight are some resources on the internet like this one

1 Like

@catacombs,
Not copy “text” from one file to another. The use case is copying one .docx file(as an object) to the text of another .docx file.

Documents (docx) [Word]

@geosoft1,
Sorry for late reply. I tried all the examples for document in unidoc/unioffice. But failed to find a method which I want.

@catacombs,
Not the same as “cp file1.txt file2.txt”.

Actually, I use windows.

  • Right-click word1.docx and select “copy”.
  • Double-click word2.docx to open it.
  • Put the cursor in the text of word2.docx. And right-click and select paste.
    Then word1.docx will be inserted into word2.docx as an object.
    like this:
    image

I don’t know if there is an explicit concatenate function but I think you can read the content of one document and insert it at the end of the other.

This is something totally different.

Embedded objects in in .docx is more like what the name says. An object that is fully embedded. Just think of it, as an image in HTML that is provided base64 encoded inline rather than the regular HTTP-URL to download the image drom.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.