通过Google Apps脚本获取Layout Presentation of Google Presentation Slide的显示名称 [英] Get Layout's display name of a Google Presentation Slide via Google Apps Scripts

查看:132
本文介绍了通过Google Apps脚本获取Layout Presentation of Google Presentation Slide的显示名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试通过Google Apps脚本将新幻灯片添加到演示文稿中,并以创建的布局添加到演示文稿中.

I am trying to append a new slide to my presentation with a created layout via Google Apps Scripts.

我开始了一个新的演示文稿,创建了两个新的布局,分别将其命名为" BulletDescription "和" TextDescription ". 我可以在演示文稿中获得所有可用的布局.但是,找不到通过它们的名称手动创建的布局.

I started a new presentation, created two new layouts, named them as 'BulletDescription' and 'TextDescription'. I can get all the layouts available in the presentation. However, I can't find the layouts which I manually created by their names.

function AddNewSlideToPresentation(LayoutType) //LayoutType = 'BulletDescription'
{ 
  var presentation = SlidesApp.openById('PresentationID');
  var layouts = presentation.getLayouts();
  var selectedLayout;
  for(var item in layouts)
  {
    Logger.log(layouts[item].getLayoutName());
    if(layouts[item].getLayoutName() == LayoutType)
    {
      selectedLayout = layouts[item];
    }
  }

  var newSlide = presentation.appendSlide(selectedLayout); // this returns an error
}

似乎 .getLayoutName()函数为我们提供了与我在日志中找到的不同的名称;

It seems that .getLayoutName() function gives us different name as I found on my log;

TITLE
SECTION_HEADER
TITLE_AND_BODY
MAIN_POINT
.
.
CUSTOM_1
CUSTOM_2

我相信CUSTOM_1CUSTOM_2是我创建的.是否可以通过Google Apps脚本获取布局的显示名称?

I believe CUSTOM_1 and CUSTOM_2 are the ones I created. Is there a way to get display name of the layout via Google Apps Script?

推荐答案

尝试使用此方法从 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆