google-docs

How does Google Docs deal with editing collisions?

僤鯓⒐⒋嵵緔 提交于 2020-05-24 08:43:05
问题 I've been toying around with writing my own Javascript editor, with functionality similar to Google Docs (allowing multiple people to work on it at the same time). One thing I don't understand: Let's say you've got User A and User B connected directly to each other with a network delay of 10ms. I'm assuming the editor uses a diff system (as I understand Docs does) where edits are represented like "insert 'text' at index 3," and that diffs are timestamped and forced to apply chronologically by

Copy image from Google Sheets to Google Docs using Google Apps Script

烂漫一生 提交于 2020-05-16 13:30:07
问题 I was working on generating a report as Google Docs document using data from spreadsheets. Some parts of the sheets contain a step-by-step screenshot walkthrough (That is, text, image, text, image vertically). That needs to be copied to the doc. I have read through Google Apps Script reference and found that OverGridImage represent the image in the file. However, there was no method that allows exporting as a blob, or even a URL. (Since the image pasted on the sheets come directly from

Apps Script vs Chrome Extension: Writing an alternative spellchecker to Google Docs

半城伤御伤魂 提交于 2020-05-16 08:55:50
问题 Say, I want to develop an alternative spellcheck module to google docs . This means that I have to get corrections from my backend, and color the misspelled text's background, and do a small popup bubble when user hovers over it, where I'd display the correction. (please mind that spellcheck is not the actual goal of my project, but it does address my problems in a more simplified way) What are my options? Any ideas how to do this? Few possible solutions I came up with: Chrome extension vs

Apps Script vs Chrome Extension: Writing an alternative spellchecker to Google Docs

你。 提交于 2020-05-16 08:54:28
问题 Say, I want to develop an alternative spellcheck module to google docs . This means that I have to get corrections from my backend, and color the misspelled text's background, and do a small popup bubble when user hovers over it, where I'd display the correction. (please mind that spellcheck is not the actual goal of my project, but it does address my problems in a more simplified way) What are my options? Any ideas how to do this? Few possible solutions I came up with: Chrome extension vs

Replace Hyperlinks in Multiple Google Docs

久未见 提交于 2020-04-18 07:25:30
问题 I entered the following code posted by ziganotschka on https://stackoverflow.com/a/57865441/12252776: function myFunction() { var oldLink="http://www.googledoclink1.com"; var newLink="http://www.googledoclinkA.com"; var oldLink2="http://www.googledoclink2.com"; var newLink2="http://www.googledoclinkB.com"; var files = DriveApp.getFiles(); // Note: this gets *every* file in your Google Drive while (files.hasNext()) { var file = files.next(); Logger.log(file.getName()); var doc = DocumentApp

Can't get menu item to show in an unpublished add-on for google document

落花浮王杯 提交于 2020-04-17 22:54:29
问题 My code look like that: function onInstall(e) { onOpen(e); } function onOpen(e) { DocumentApp.getUi().createAddonMenu() .addItem("Format Your Text", "autoFormatting") .addToUi(); } function autoFormatting() { //some code } I have set a project in Google Cloud Platform and linked in to my Google Apps Script unbound project. Enabled the G Suit Marketplace SDK and configured it. The version is the correct one. When I test the script as add-on in any state (installed/enabled/both) the menu item

Looking for a way to add borders to a paragraph in a google doc using a Google Apps Script or perhaps the DOCS API?

余生颓废 提交于 2020-04-17 22:09:29
问题 It is possible to add a border to a google doc paragraph via the Format menu > Paragraph styles > Borders and shading . The result looks like this: However, I have not managed to work out how to do this using Google Apps Scripts? I have consulted the documentation concerning setting attributes, however, borders do no appear. It seems it is possible to set them using sheets and slides - but that isn't the use-case I am after. I used the DOCS API via node.js to download the sample JSON returned

Get the ranges of the elements in a google doc using Google Apps Script

試著忘記壹切 提交于 2020-03-28 06:50:40
问题 Following on from this question - I am now unsure how I might be able to target certain paragraphs or elements within the document when using Google Apps Scripts in order to use the batch update method outlined one would need to find the range of the element that required styling. If there were 10 empty paragraphs (with content of "\n",) in a document - how would it be possible to target the 8th paragraph and get the range values {"startIndex": xx, "endIndex": xx} relative to the document so

using google docs api from within google apps script

[亡魂溺海] 提交于 2020-03-24 00:10:55
问题 I'm trying to use the following code from the google docs API from within google apps script for testing purposes: var f = UrlFetchApp.fetch("https://docs.googleapis.com/v1/documents/1ys6KIY1XOhPHrgQBJ4XxR1WDl0etZdmR9R48h2sP2cc:batchUpdate", { method:"post", body: JSON.stringify({ "requests": [ { "deleteContentRange": { "range": { "startIndex": 1, "endIndex": 80 } } } ] }), headers: { Authorization:"Bearer " + ScriptApp.getOAuthToken(), "Content-Type": "application/json" } }) Logger.log(f)

using google docs api from within google apps script

别等时光非礼了梦想. 提交于 2020-03-24 00:10:02
问题 I'm trying to use the following code from the google docs API from within google apps script for testing purposes: var f = UrlFetchApp.fetch("https://docs.googleapis.com/v1/documents/1ys6KIY1XOhPHrgQBJ4XxR1WDl0etZdmR9R48h2sP2cc:batchUpdate", { method:"post", body: JSON.stringify({ "requests": [ { "deleteContentRange": { "range": { "startIndex": 1, "endIndex": 80 } } } ] }), headers: { Authorization:"Bearer " + ScriptApp.getOAuthToken(), "Content-Type": "application/json" } }) Logger.log(f)