title: Customized border for google document table with Google Apps Script
body: <p>I'm very new to Google's app script. I have read the documentation and I can already do some things, but I have encountered some difficulties in resolving an issue.
  I'm using documents and I need to select text in my document and place it inside a table. This table has only one row and two columns. The selected text must be in the second cell of the line and later, I need to delete the selected text and leave only the table with the text.
  The part of selecting the text to place it on a table, I can already do it, now I'm finding it difficult to work with the table layout, specifically in what is related to the part of the table's borders. See the image below.</p>
  
  <p><a href="https://i.stack.imgur.com/oEUTG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oEUTG.png" alt="Image custom table"></a></p>
  
  <p>My table needs only to have the central border visible and in red, the other borders must be hidden.
  I did not find in the documents of the documents, nothing related to the manipulation of borders individually, but only in general for the entire table.
  The code below does a lot of the work, but the edge in the style I want, not yet.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function myFunction() {
    var doc = DocumentApp.getActiveDocument();
    var body = doc.getBody();
    var selection = doc.getSelection();
    var ui = DocumentApp.getUi();
    var text = body.editAsText();
    var report = "";
    //----------------------------------------------------------------------------------------------------------\\
    
    if (!selection) {
      report += " Nenhuma seleção atual ";
      ui.alert( report );
    }
    else{
      var elements = selection.getSelectedElements();
      var element = elements[0].getElement();
      var selectedText = element.asText().getText();
      
      var styleCell1 = {};
      styleCell1[DocumentApp.Attribute.FONT_SIZE] = 20;
      styleCell1[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] = DocumentApp.HorizontalAlignment.CENTER;
      styleCell1[DocumentApp.Attribute.FOREGROUND_COLOR]='#888888';
      styleCell1[DocumentApp.Attribute.FONT_FAMILY]='Roboto';
      
      var styleCell = {};
      styleCell[DocumentApp.Attribute.FONT_SIZE] = 18;
      styleCell1[DocumentApp.Attribute.FOREGROUND_COLOR]='#000000';
      styleCell[DocumentApp.Attribute.HEADING] = DocumentApp.ParagraphHeading.HEADING1;
      styleCell[DocumentApp.Attribute.FONT_FAMILY]='Roboto';
      
      var cells = [
        ['', '']
      ];
      
      //body.insertParagraph(0, doc.getName()).setHeading(DocumentApp.ParagraphHeading.HEADING1);
      table = body.appendTable(cells);
  
      table.getRow(0).editAsText().setBold(true);
      table.getRow(0).getCell(1).setText(selectedText);
      table.getRow(0).getCell(1).setAttributes(styleCell);
      table.getRow(0).getCell(0).setWidth(59);
      table.getRow(0).getCell(0).setAttributes(styleCell1);
      table.setBorderColor('#ffffff');
      table.setBorderWidth(3);
    }
  }</code></pre>
  </div>
  </div>
  </p>