Skip to content

Instantly share code, notes, and snippets.

@mogsdad
Created December 12, 2015 03:45
Show Gist options
  • Save mogsdad/7fed0b18837b9027f968 to your computer and use it in GitHub Desktop.
Save mogsdad/7fed0b18837b9027f968 to your computer and use it in GitHub Desktop.
Google Apps Script utility to Get the string representing a PositionedLayout enum. See https://mogsdad.wordpress.com.
/**
* Get the string representing the given PositionedLayout enum.
* Ref: https://developers.google.com/apps-script/reference/document/positioned-layout
*
* From: gist.github.com/mogsdad/7fed0b18837b9027f968
* See: stackoverflow.com/a/20661113/1677912
*
* @param {PositionedLayout} PositionedLayout Enum value.
*
* @returns {String} English text matching enum.
*/
function getLayoutString( PositionedLayout ) {
var layout;
switch ( PositionedLayout ) {
case DocumentApp.PositionedLayout.ABOVE_TEXT:
layout = "ABOVE_TEXT";
break;
case DocumentApp.PositionedLayout.BREAK_BOTH:
layout = "BREAK_BOTH";
break;
case DocumentApp.PositionedLayout.BREAK_LEFT:
layout = "BREAK_LEFT";
break;
case DocumentApp.PositionedLayout.BREAK_RIGHT:
layout = "BREAK_RIGHT";
break;
case DocumentApp.PositionedLayout.WRAP_TEXT:
layout = "WRAP_TEXT";
break;
default:
layout = "";
break;
}
return layout;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment