Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
Show all 9 items in the list
Tags used for linking issues. [ID: 1172495]
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
First, please search through existing issues to ensure that the bug has not already been reported. You can start the search here:
If the issue has already been reported, you can click the star next to the issue number to subscribe and receive updates. We prioritize responding to the issues with the most stars. You can also comment on the issue to provide any details of your experience with it.
If your issue has not been reported, please provide all of the following:
-----------------------------------------------------------------------------------------------------------------------------
Copying a document structure from one document to another by walking through the children of the source document and inserting them into a target document has a number of problems when it comes to table cells that have inline drawings in a cell.
The inline drawings are invisibly linked back to the source document; That is, if you open the inline drawing in the target document and modify it, the inline drawing in the source document gets modified at the same time. Similarly, if you modify the inline drawing in the source document then the inline drawing in the destination document(s) is also modified.
This behaviour in some cases would be desirable, however, the tables are inserted using table.copy() which is supposed to give a detached deep copy of a table and all it's cells.
As a side effect of this problem, any documents created with these tables and downloaded as PDF (only PDF tested so far) have the inline drawing replaced with a triangle exclamation, presumably due to the linked graphic not being shared publicly in the originating document.
None of the documents created from the source document indicate in the Tools Menu that there are ANY Linked Objects to be updated. It's all hidden.
A small code sample that reliably reproduces the issue. The sample should run as-is or with minimal setup, without external dependencies.
function copyDoc(sourceDocId, targetDocId) {
//Just dealing with paragraphs and tables
var sourceDoc = DocumentApp.openById(sourceDocId);
var targetDoc = DocumentApp.openById(targetDocId);
// Clear the target destinations body
targetDoc.getBody().clear();
// Get the body of the source document and detach it with copy()
var sourceBody = sourceDoc.getBody().copy();
let index = 0;
let el, type;
// Walk through the sources detached body and deal with the children
for (let i = 0; i < sourceBody.getNumChildren(); i++) {
el = sourceBody.getChild(i);
type = el.getType();
switch (type) {
case DocumentApp.ElementType.PARAGRAPH:
targetDoc.insertParagraph(index, el.copy());
index++;
break;
case DocumentApp.ElementType.TABLE:
targetDoc.insertTable(index, el.copy());
index++;
break;
}
}
}
What steps will reproduce the problem?
1. Create a source document with a table. Insert a NEW drawing into one of the table cells, add an image inside the drawing and save/close.
2. Create a blank destination document. It doesn't matter if you insert anything here as the script will clear the body anyway.
3. Plug the source doc id and the destination doc id into the script and run it.
What is the expected output? What do you see instead? If you see error messages, please provide them.
The target document tables and paragraphs will resemble the source document exactly.
However, if you now make any changes to the embedded drawing in the destination document, those changes are reflected in the source document and vice versa. Also, if you download as PDF the destination document, the drawing graphic is missing and replaced with a triangle exclamation.
Please provide any additional information below.
No further information to add except this problem is holding up a project that relies on PDF export.