Need help creating custom text- and paragraph styles

28 views
Skip to first unread message

Seb

unread,
Jul 17, 2019, 11:48:55 AM7/17/19
to Google Apps Script Community

Hello!

I need help creating a script that can replicate most, if not all, of the custom functions I currently have in a LibreOffice document. You'll have to excuse me for this overly long post, I don't expect anyone to just do this for me. But I want to describe the very specific things I'm trying to do.


I have successfully so far imported the document into Google Drive and used "Update Heading X" to apply some of the functionallity. However, it doesn't inherit custom chapter counting, automatic switch to another style afterwards or a default text I want shown with each and every heading of that type. I has inherited the black lines on the top and bottom, however I fail to find how I can add those myself. "Insert > Horisontal Line" only yields a grey line, which is also a bit shorter than the one I use. Another thing that becomes and issue is the inability to rename the styles. I have to learn what each and every one is, that's not a huge issue in and off itself but if I could make entirely custom ones that would be amazing.



Now, text styles I've managed a bit better with. However, I need two types of underlining. Solid underline, and a dotted one. As I've understood it dotted lines aren't supported by Google Docs yet. But if there's an alternative, or a way to force it I'm happy with that.


I'll include a picture of what I want to create along with descriptions of it all.

Anteckning 2019-07-17 173016.png


  • Heading. Arial, size 20, Bold and Italic. With a solid black line from margin to margin on the top and bottom. Ideally I want "Akt " and then an automatic counter to be added automatically.
  • Heading. Arial, size 16, Bold. Capital letters, with "real" capitals being larger. The "Capitals" option in Google Docs seem to make every character equal size.
    • It should inherit "Scen ", then a number counter, then a long dash and a space.
    • When I press Enter I want to switch automatically to a paragraph style with a right align, 12 size arial and bold. 
  • I want a style that is tabbed in 3 cm from the margin, times new roman, size 13 and italics.
  • I want a style that starts at the margin, tabs in 3 cm. 
    • When I press Alt+Enter I want to stay tabbed in and have a line spacing of 1.
    • When I press Enter I want to go to the margin, with a line spacing of 1.5.
  • I also want a paragraph style for "Låtläge" which works similarly to "Scen" above. But ideally I want so I go to a new style when I press Enter, like "beskrivning av låtläget."

For the text styles I've succesfully created my own drop down menu that can do most of what I want. But I'm missing a few features. 

  • Dotted lines.
  • Transparent background. (Now I'm doing the ugly method of making the color white. It works, but I don't like it.
  • And if possible, adding ( ) around words. Now I do it manually, which is fine. But heck, why not go all out?

Now, to be absolutely clear. I don't expect anyone of you to just do this for me. If you did I would be immensly grateful but what I'm really after is just help to get started. Where can I find what functions I can use that does these things? What of what I'm after are simply not possible? Can I even add custom paragraph styles with a script?


The next logical step if I manage to do this is to add keyboard shortcuts as well. But that's a problem for another day. :P 
Reply all
Reply to author
Forward
0 new messages