0

Is there a way to highlight a specific word in a docx file that is viewed by using google doc

Example: I am having the following document and i'm viewing it using google docs and i need to highlight "Step" word with another color inside the document

Google Doc Document

Is there any available approach to use other than open the document, Edit it, save and then return it to Google doc viewer?

Amr Ramadan
  • 1,259
  • 5
  • 18
  • 29

1 Answers1

0

You can use Google Apps Script to create, access, and modify Google Docs files.

Here's an example from the documentation that changes half the text to blue:

 var body = DocumentApp.getActiveDocument().getBody();

 // Use editAsText to obtain a single text element containing
 // all the characters in the document.
 var text = body.editAsText();

 // Insert text at the beginning of the document.
 text.insertText(0, 'Inserted text.\n');

 // Insert text at the end of the document.
 text.appendText('\nAppended text.');

 // Make the first half of the document blue.
 text.setForegroundColor(0, text.getText().length / 2, '#00FFFF');

To highlight a specific word, you can use findText().

NovaLogic
  • 658
  • 13
  • 21
  • I think this is a good solution but do you know how to register google apple script in my html project? as i didn't find any article in google documentation state that – Amr Ramadan Nov 16 '15 at 18:10
  • You can use it only for sites built with Google Sites. http://stackoverflow.com/questions/15457067/can-you-use-google-scripts-on-a-website-thats-not-created-under-google-sites – NovaLogic Nov 16 '15 at 21:58