I'm trying to create a script for Google Docs with some specific paragraphs configs. Docs only have a few number of paragraphs styles ("Title", "Headings", etc.).
I need a script with this configs:
4 cm indentation; Arial, font size 10; line spacing should be simple; a space of 1.5 must be left between the rest of the text and the citation; justified text.
In other words, I want to create a new paragraph style ("Citations").
I've alredy found a good script on the internet but I have no idea how to modify this with the configs that I mentioned before (yes, I'm a newbie).
Heres the code of the script I've mentioned before:
// is called by google docs when a document is open// adds a menu with a menu item that applies a style to the currently selected textfunction onOpen() { DocumentApp.getUi() .createMenu('Extras') .addItem('Apply code style', 'applyCodeStyle') .addToUi();}// definition of a style to be appliedvar style = { bold: false, backgroundColor: "#DDDDDD", fontFamily: DocumentApp.FontFamily.CONSOLAS};// helper function that strips the selected element and passes it to a handlerfunction withElement(processPartial, processFull) { var selection = DocumentApp.getActiveDocument().getSelection(); if (selection) { var elements = selection.getSelectedElements(); for (var i = 0; i < elements.length; i++) { var element = elements[i]; if (element.getElement().editAsText) { var text = element.getElement(); if (element.isPartial()) { var from = element.getStartOffset(); var to = element.getEndOffsetInclusive(); return processPartial(element, text, from, to); } else { return processFull(element, text); } } } }}// called in response to the click on a menu itemfunction applyCodeStyle() { return withElement( applyPartialStyle.bind(this, style), applyFullStyle.bind(this, style) );}// applies the style to a selected text rangefunction applyPartialStyle(style, element, text, from, to) { text.setFontFamily(from, to, style.fontFamily); text.setBackgroundColor(from, to, style.backgroundColor); text.setBold(from, to, style.bold);}// applies the style if the entire element is selectedfunction applyFullStyle(style, element, text) { text.setFontFamily(style.fontFamily); text.setBackgroundColor(style.backgroundColor); text.setBold(style.bold); }In fact, I wanna create a specific paragraph style for citations with this config: "4 cm indentation; Arial, font size 10; Line spacing should be simple; A space of 1.5 must be left between the rest of the text and the citation; Justified text".
I've found and used the code script that I mentioned on the question because it works, but I have to adapt it to the paragraphs configs that I need. That's the point, guys: I have no idea how to adapt this. Some tips?
So, I wanna create a new paragraph style (not "Headings" and "Titles") for my academic citations (that's the reason of some specifics configs, as font size, font type, etc.). Microsoft Word offers a "Citation" paragraph button, but Docs no.
Thanks all!