Status Update
Comments
ja...@google.com <ja...@google.com> #2
It looks like you are raising an issue as an Android user, rather than an Android Open Source Developer. Our Android Support team will be in contact with you shortly. In the meantime, here are helpful resources:
we...@appnovation.com <we...@appnovation.com> #3
ja...@google.com <ja...@google.com> #4
Can you provide the below requested information to better understand the issue:
Android build Which Android build are you using? (e.g. KVT49L)
Device used Which device did you use to reproduce this issue?
Android bug report (new bugreport) After reproducing the issue, press the volume up, volume down, and power button simultaneously. This will capture a bug report on your device in the “bug reports” directory.
Alternate method: After reproducing the issue, navigate to developer settings, ensure ‘USB debugging’ is enabled, then enable ‘Bug report shortcut’. To take bug report, hold the power button and select the ‘Take bug report’ option.
Note: Please upload the files to google drive and share the folder to
Description
Using the insertParagraph() function in Docs to copy header elements produces a Documents services error if there is an image in the header.
I created a Docs add-on to help quickly replace the header and footer sections of our company’s Docs to show our new company logo and text tagline from the old. The add-on referenced a source GDoc with the appropriate header and footer elements based on its document ID and would insert child elements of the HeaderSection, element by element, as the Docs AppScript does not have a “setHeader(header)” type of function.
Code snippet (edited down for brevity):
function onOpen(e) {
var ui = DocumentApp.getUi();
ui.createMenu('Replace Header')
.addItem('With WrapText Image Header','copyAndApplyHeader')
.addToUi();
}
function testFunction(documentID)
{
var sourceDoc = DocumentApp.openById(documentID); // the document to copy the header elements from
var sourceElements = "";
var numElements = 0;
var doc = DocumentApp.getActiveDocument(); // destination document, where you want the header elements copied to to
if (doc.getHeader() == null)
doc.addHeader();
else
doc.getHeader().clear(); // clear the contents of the HeaderSection in the destination document first
sourceElements = sourceDoc.getHeader().copy();
numElements = sourceElements.getNumChildren();
for (var i=0;i<numElements;i++)
doc.getHeader().insertParagraph(i,sourceElements.getChild(i).copy());
}
function copyAndApplyHeader()
{
testFunction("1glCcLcdvQQBdRZW-kcNLPfzgxcG4Uc5SbRscTzCVckQ"); // publicly available GDoc link
}
What steps will reproduce the problem?
Pre-condition: The above code is added via the Script Editor in an empty Doc (the destination doc) permissions have been granted to run the add-on. The document id of the source Doc to copy header elements from is publicly viewable (but not editable).
Steps:
1. Click on the Replace Header > With WrapText Image Header menu option.
What is the expected output? What do you see instead? If you see error messages, please provide them.
Expected behavior: The destination doc’s header should show 3 elements:
1. A smiley image, left-aligned, with the "Wrap text" property set
2. A sentence of text right-aligned, almost middle-aligned to the smiley image
3. A horizontal line beneath both the smiley image and text sentence.
What is seen instead:
An error message with a red background saying: “Service unavailable: Documents”. No elements from the source Doc are copied over to the destination Doc.
Please provide any additional information below.
After some debugging and troubleshooting, it looks like the issue is centered around the insertParagraph() function and if a Paragraph element has an image in it. Specifically, if the image has its layout property set to Wrap text or Break text, it seems to be recognized as a PositionedImage object which isn’t defined as an Element. If however, the image is set to be In line for its layout property, the add-on code behaves as expected, but if it's set to In line, the layouts of the elements won't be able to be shown and positioned nicely as before.
Link to the Positioned Image reference page:
This add-on was deployed within the organization in early June 2019 and worked fine around mid-September 2019 when the error was first noticed.
I have tried to look into workarounds such as recreating the header elements and putting them into table cells, but that apparently is not working as intended either based on this issue logged: