My script searches one specific slide in a presentation. Then it gets the text from the first page element. This page element is a shape with only one word. After this, when I put strings before and after this page element text, there is a break in the text.
function readShapeText() {
var presentation = SlidesApp.getActivePresentation();
var slides = presentation.getSlides();
for (i = 0; i < slides.length; i++) {
if(slides[i].getObjectId() == 'mySlideId'){
var pageElement = slides[i].getPageElements()[0].asShape().getText().asString();
}
}
var myModifiedElement = "My_" + pageElement + "_is_cool";
}
The output is with a break, but I need in one line:
My_TestElement
_is_cool
How can I eliminate or suppress the break? And is there a better way to find a specific slide without using "for loop" f.e. like presentation.openSlideById(xxxxxx)?