From 515d0c79164a594522960ff8e5a41624cab01b5d Mon Sep 17 00:00:00 2001 From: Ivan <6350992+bivant@users.noreply.github.com> Date: Mon, 23 Sep 2019 16:10:47 +0300 Subject: [PATCH] Export result dialog, textareas: add title, fit width to parent --- Code.gs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Code.gs b/Code.gs index 66bde0c..c7a1f64 100644 --- a/Code.gs +++ b/Code.gs @@ -128,17 +128,22 @@ function makeButton(app, parent, name, callback) { return button; } -function makeTextBox(id, content) { - var textArea = ''; +function makeTextBox(id, title, content) { + var textArea = '

' + title + '<\p>'; return textArea; } function displayTexts_(texts) { var app = HtmlService.createHtmlOutput().setWidth(800).setHeight(600); - + + var ss = SpreadsheetApp.getActiveSpreadsheet(); + var sheet = ss.getActiveSheet(); + var headersRange = sheet.getRange(1, FIRST_COLUMN_POSITION + 2, HEADER_ROW_POSITION , sheet.getMaxColumns()); + var headers = headersRange.getValues()[0]; + for (var i = 0; i < texts.length; i++) { - app.append(makeTextBox("export_" + i, texts[i])) + app.append(makeTextBox("export_" + i, headers[i], texts[i])) } SpreadsheetApp.getUi().showModalDialog(app, "Translations");