google-docs

google doc script, attributes (bold, italics, underline) not shown in log

会有一股神秘感。 提交于 2019-12-24 12:50:28
问题 i want to create a script to capitalize sentences in a google doc, but without changing existing attributes in certain words. for example, in a google doc, there would be several paragraphs, with each paragraph having several sentences. in such google doc, there would be hyperlinks, words in boldface, words in italics, words with underline, etc. i want all of these attributes to stay intact; the script should only capitalize the sentences, without removing the existing attributes for these

google drive apps script > “Service unavailable: Docs”?

南笙酒味 提交于 2019-12-24 11:46:58
问题 I have a script that takes a Google spreadsheet writes the text to a Google Doc. When I try to run the function, I get the message in red at the top of the page Service unavailable: Docs (Dismiss) . This is new. What does this error mean? Thanks! 回答1: In addition to @Pierre-Marie Richard's answer, the error Service unavailable: Docs usually happens when you are using an invalid Doc ID. 回答2: As mentioned in the documentation : Server not available. Server error occurred, please try again.

Script stopping, may be due to onEdit() SpreadsheetApp call and then DocumentApp call

我的梦境 提交于 2019-12-24 05:45:33
问题 this script stops just at the entry of the last function : addToDocument(). Until this point all is working. I presume a problem due to onEdit() and DocumentApp call? Note that separately, my addToDocument() works perfectly. function onEdit() { // simple timestamp -- when a single "t" is entered in a cell, replace it with a timestamp // see https://productforums.google.com/d/topic/docs/rC6MpQDC7n4/discussion var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var cell =

Formatting text with apps script (Google Docs)

青春壹個敷衍的年華 提交于 2019-12-24 05:30:28
问题 I have made some apps script to format text in a Google Doc, but: I can't figure out how to stop the script breaking when the text isn't found. The script doesn't look very efficient. // Set the whole body to Roboto 10 var FontStyle = {}; FontStyle[DocumentApp.Attribute.FONT_FAMILY] = 'Roboto'; FontStyle[DocumentApp.Attribute.FONT_SIZE] = 10; body.setAttributes(FontStyle); // Set some elements to bold var BoldStyle = {}; BoldStyle[DocumentApp.Attribute.BOLD] = true; var pattern1 = "Private &

Passing information to server-side function in a Google Docs Add On

爱⌒轻易说出口 提交于 2019-12-24 04:59:05
问题 I'm working on a Google Docs Add-On based on Google's Quickstart tutorial. I'm trying to change the workflow of the Add On in the tutorial to append a new page and then insert a translation on that new page rather than the line-by-line workflow. I have a script working in single documents but I'm having a hard time moving it to the Add On architecture. I think it's something to do with passing selections from client-side JS to the server-side script doing the translation. Here's the translate

Google Docs Pixels to Inches

蹲街弑〆低调 提交于 2019-12-24 00:36:29
问题 Is anyone aware of the formula google docs use to convert pixels to inches? Right click on a cell and click table properties then you get the image below, note I have opened up firebug and you can clearly see each td is set with a px width. I can work with inches or mm or equivalent for printing to pdf but pixels is not so accurate. This is all done on client side hence the javascript tag... 回答1: Haroon, I'm not sure what you're trying to do, but PC displays are generally 96DPI and I think

How to add header in Google spreadsheet

青春壹個敷衍的年華 提交于 2019-12-23 11:55:20
问题 I am using gdata-spreadsheet-3.0 jar to enter data in a Google spreadsheet. I am using (new ListEntry()).getCustomElements().setValueLocal("Header Name", "Value"); But I don't want to create the header manually. I am unable to enter/create the header of the spreadsheet with Java. I’m also unable to enter data using spreadsheet's header (means A B C...). Can I create a header or can I use spreadsheet's header (means A B C...)? 回答1: I would try to use the cell objects/feeds to set the values in

Upload and replace file in given folder on Google Docs using .net api

試著忘記壹切 提交于 2019-12-23 05:35:23
问题 I'm trying to upload a file to a given folder using the .net client for google-api. I can do this using: service = new DocumentsService("SRDUploader"); DocumentEntry lastUploadEntry = service.UploadDocument(file, null ); That works fine, but I need to more things: How can I specifying the destination folder (tried with "\My folder\file.txt" as secound arg)? How can I specify that I wan't to overwrite the existing file? I'm using version 2 version of the .net client api. Maybe there's another

How can I hide the heading and options bar in google drive

为君一笑 提交于 2019-12-23 05:02:04
问题 I want to hide the top options bar in google drive. How can I achieve that? I am using cordova inAppBrowser to open this link. https://drive.google.com/file/d/0B_nipvep1WpPd2JXeDdJcUlNYXM/view I want to use embedded=true but I don't know how it would work. Please see the image below. 回答1: May be this will help you You have to wait until your inAppBrowser page loading finishes. //Set css in your inAppstyle.css .drive-viewer-toolstrip{ display: none !important; opacity: 0 !important; } You must

Get Table Cell Values Google Docs

六眼飞鱼酱① 提交于 2019-12-23 04:53:27
问题 We have a Google Document with a Table init, where we need to get the values inside the table cells into an Array. The table looks like this in Google Doc: I found a way to logg the values in the cells with this code: var searchElement = copyBody.findElement(DocumentApp.ElementType.TABLE); var element = searchElement.getElement(); var table = element.asTable(); var tablerows = element.getNumRows(); for ( var row = 0; row < tablerows; ++row ) { var tablerow = element.getRow(row) for ( var cell