Format Paragraf Google Form

Kolaborasi antara Google Form dengan App Google Script ternyata bisa memformat paragraf. Paling tidak bisa mengurangi banyaknya image hasil snipping tool. Cara penggunaan App Google Script juga mudah. Kita awali dengan membuat Form sesuai kebutuhan, setelah itu kita insert Google Script ke Form melalui tab Editor Script.

Ini lho Google Scriptnya

function onOpen() {
  var ui = FormApp.getUi();
  ui.createMenu('Scripts')
    .addItem('Replace 4+ spaces with line breaks in Title and Description', 'addLineBreaks')
    .addToUi();
}

function addLineBreaks() {
  var theForm = FormApp.getActiveForm();
  var theQuestions = theForm.getItems();
  var thePlaceholder = new RegExp(/\s{4,99}|\n/, 'gi');
  for (i = 0; i < theQuestions.length; i++) {
    var theText = theQuestions[i].getHelpText();
    if (theText.search(thePlaceholder) > 0 ) {
      theQuestions[i].setHelpText(theText.replace(thePlaceholder,'    \n'));
    }
    theText = theQuestions[i].getTitle();
    if (theText.search(thePlaceholder) > 0 ) {
      theQuestions[i].setTitle(theText.replace(thePlaceholder,'    \n'));
    }
  }
}

Silahkan Copy dan dipastekan di Google Form melalu Editor Script. Jangan lupa disimpan (save) lho.

Setelah tahapan memasukkan Google Script ke Google Form selesai, langkah berikutnya menambahkan 4x karakter kosong di setiap akhir baris. Ingat!!! Hanya 4x karakter kosong yang ditambahkan untuk memformat agar kalimat yang kedua bisa terletak dibaris bawahnya.

Baca juga: Format Text (bold-italic-underline) di Google Form

Untuk lebih jelasnya bisa kita simak tutorial berikut.

Semoga bermanfaat

Comments

Subscribe Us