使用PHP从一个演示文稿导入/复制幻灯片

时间:2017-10-26 11:36:40

标签: google-api google-slides-api

我需要使用幻灯片API将一些幻灯片从一个演示文稿导入/复制到新演示文稿。经过大量的搜索,我找不到任何关于它的信息。

我使用 Google幻灯片API 。 我使用此代码获取演示文稿A 的幻灯片,并对获取其他演示文稿B 的幻灯片完全相同。我创建新演示文稿,但我不知道如何将幻灯片A和幻灯片B复制/设置到新演示文稿中

可能是解决方案可能在foreach循环中执行一些像这样的代码

// Get the API client and construct the service object.

$client = getClient();
$service_slides = new Google_Service_Slides($client);
$service_drive = new Google_Service_Drive($client);

/************************************
Create a new empty presentation
************************************/
$nueva_presentation = new Google_Service_Slides_Presentation(array(
  'title' => utf8_encode('Name of the presetantion')
));

$nueva_presentation = $service_slides->presentations->create($nueva_presentation);
printf("Created presentation with ID: %s\n", $nueva_presentation->presentationId);

// Prints the number of slides and elements in a presentation
$presentationId = '1TCn0MLrjz05GrWTgcW3r5tRM4l4v9iy1gfunyQAB5kQ';
$presentation = $service_slides->presentations->get($presentationId);
$slides = $presentation->getSlides();
$pageElements = $slide->getPageElements();

printf("The presentation contains %s slides:\n", count($slides));
foreach ($slides as $i => $slide) {
  // Print columns A and E, which correspond to indices 0 and 4.
  printf("- Slide #%s contains %s elements.\n", $i + 1,
      count($slide->getPageElements()));
      $id_slide=$slide->getObjectId();
      echo "<br>pageObjectId=".$id_slide;
}

// Prints the number of slides and elements in a presentation
    $presentationId = '1fRz9_WgyfkWYMVkhL6Wox_BioE4C2pSQxKqhDw-GrkU';
    $presentation = $service_slides->presentations->get($presentationId);
    $slides = $presentation->getSlides();
$pageElements = $slide->getPageElements();

    printf("The presentation contains %s slides:\n", count($slides));
    foreach ($slides as $i => $slide) {
      // Print columns A and E, which correspond to indices 0 and 4.
      printf("- Slide #%s contains %s elements.\n", $i + 1,
          count($slide->getPageElements()));
          $id_slide=$slide->getObjectId();
          echo "<br>pageObjectId=".$id_slide;
    }

但我不知道正确的方法

root.after(30000, lambda: showFirstScreen())

0 个答案:

没有答案