'Two Text Links in the Same Row in Google Apps Add-On

I'm working on an add-on based in the CardService functions in Google Apps Script. At one point in my UI, I want to have a pair of hyperlinks in the same "row" of the card (the first being left-aligned on the card, and the second being right-aligned).

Here's what I have so far:

    var urlText = CardService.newTextParagraph()
.setText("<a href ='" + shURL + "'>" + "File No. " + fileNo + "</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href ='" + folderURL + "'>" + "Drive Folder</a>")

Obviously the manual way is the wrong way to space the two out.

What do you think is the best way to do this? I see the Grid widget, but it doesn't seem to enable me to have separate hyperlinks. Same with the DecoratedText widget.

Any ideas would be much appreciated. Thanks!



Solution 1:[1]

Summing up what's discussed in the comments, at the date of this answer textParagraph() provides Text Formatting support but limited to:

Bold    = <b>test</b>
Italics = <i>test</i>
Underline   = <u>test</u>
Strikethrough = <s>test</s>
Font color =    <font color="#ea9999">test</font>
Hyperlink = <a href="http://www.google.com">google</a>
Time =  <time>2020-02-16 15:00</time>
Newline = test <br> test

Aside from the above, text alignment is not mentioned.

After testing Grid and DecoratedText options are also not suitable for this use case either. Also, be aware of the use of HTML/CSS for its format falls in one of the restrictions documented here.

Since this is a missing feature, you may want to submit a Feature Request so it may be considered in the future.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1