App Script for Document

35 views
Skip to first unread message

T J

unread,
Feb 13, 2020, 5:34:53 AM2/13/20
to Google Apps Script Community
Ok so i have a client that collects data for clients and stores it currently in word. 

The format is something like below:

//Heading

The special relationship Still lives On between britain and US

//URL to Article and Date of Article

http://www.theguardian.com/commentisfree/2013/sep/07/special-relationship-britain-us, 07/09/2013

//Snippet of Article Content

In an opinion piece for The Observer, US ambassador to the UK Matthew Barzun, writes "On the solid foundation of shared values, the special relationship will live on as strongly as ever through this international crisis. That is to the good of the people of the United States, Britain, and every nation."


The customer currently uses a Microsoft Word Macro to do the following:


They have a macro form that has several functions on it. 


Button to Update Hyperlinks, Format Text based on font chosen and a further option to convert soft returns to paragraphs.


1. Search the document for all hyperlinks then against a predefined list of websites reads through each hyperlink and if matches the predefined list changes the URL displayed but keeps the link. 

example of this of the above content would be the link: http://www.theguardian.com/commentisfree/2013/sep/07/special-relationship-britain-us would change to "The Guardian"


2. Format the text of the document.

  • Formats the paragraph to justify
  • Find the first row of each paragraph and make the first letter of each word capital and the line bold size to 11 and font to that selected on the form.
  • Find at the end of each story text that includes: Also in: then url and displays warning of each story missing an also in element.
3. Finds soft returns ^1 and replaces them with hard returns (paragraph) ^p if selected on the form displayed. 


Any help would be appreciated in getting this working in google docs.


I have completed some of the formatting code and can share but the hyperlink part is difficult and I am struggling to find the correct resource to help.


Thanks in advance


Andrew Roberts

unread,
Feb 13, 2020, 10:37:40 AM2/13/20
to google-apps-sc...@googlegroups.com
If you share what you've got so far for the link processing we can take a look...

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/2c86f128-3e11-43de-806a-a7f702e51013%40googlegroups.com.

T J

unread,
Feb 13, 2020, 2:36:45 PM2/13/20
to google-apps-sc...@googlegroups.com
Hi Andrew,


Again thanks in advance.
Reply all
Reply to author
Forward
0 new messages