PPT处理控件Aspose.Slides功能演示:使用C ++在PowerPoint演示文稿中使用笔记

有时可能会遇到必须在PowerPoint演示文稿中以编程方式添加或更新此类注释的情况。鉴于此,本文将介绍如何使用C ++以编程方式在PowerPoint演示文稿中使用笔记。

Microsoft PowerPoint提供了向幻灯片中添加注释的选项。这些注释可以通过提供其他信息和上下文对演示者有所帮助。可能会遇到必须在PowerPoint演示文稿中以编程方式添加或更新此类注释的情况。鉴于此,本文将介绍如何使用C ++以编程方式在PowerPoint演示文稿中使用笔记。

PPT处理控件Aspose.Slides功能演示:使用C ++在PowerPoint演示文稿中使用笔记

  • 使用C ++从PowerPoint幻灯片阅读笔记
  • 使用C ++将笔记添加到PowerPoint幻灯片
  • 使用C ++更新PowerPoint幻灯片的说明
  • 使用C ++从PowerPoint幻灯片中删除笔记

Aspose.Slides for C ++ 本机C ++库,支持创建,读取和操作PowerPoint文件。该API还支持在PowerPoint演示文稿中使用笔记。您可以点击下方按钮下载体验。

整合所有格式API处理套包Aspose.Slides正在网火热销售中,新购优惠折上折!联系客服立马1分钟了解全部咨询!


使用C ++从PowerPoint幻灯片阅读笔记

以下是从PowerPoint幻灯片中读取注释的步骤。

  • 使用Presentation 类加载PowerPoint演示 文稿
  • 访问INotesSlideManager使用用于特定的幻灯片> idx_get(int32_t指数) – – > get_NotesSlideManager()Presentation-> get_Slides()方法。
  • 使用INotesSlideManager-> get_NotesSlide()方法检索幻灯片注释。
  • 使用INotesSlide-> get_NotesTextFrame()-> get_Text()方法阅读注释。

以下是使用C ++从PowerPoint幻灯片中读取注释的示例代码。

// Source PowerPoint fileconst String sourceFilePath = u"SourceDirectory\slide-notes.pptx";// Load the Presentation fileSharedPtrpresentation = MakeObject(sourceFilePath);SharedPtrnotesManager = presentation->get_Slides()->idx_get(0)->get_NotesSlideManager();// Read slide notesSharedPtrnote = notesManager->get_NotesSlide();Console::WriteLine(note->get_NotesTextFrame()->get_Text());

使用C ++将笔记添加到PowerPoint幻灯片

Aspose.Slides for C ++使您能够向PowerPoint幻灯片添加注释。为此,请访问INotesSlideManager以获取所需的幻灯片,然后添加注释。以下是将注释添加到特定PowerPoint幻灯片的步骤。

  • 首先,使用Presentation 类加载PowerPoint演示 文稿。
  • 访问INotesSlideManager使用用于特定的幻灯片> idx_get(int32_t指数) – – > get_NotesSlideManager()Presentation-> get_Slides()方法。
  • 使用INotesSlide-> get_NotesTextFrame()-> set_Text(System :: String值)方法设置注释文本
  • 最后,使用Presentation-> Save(系统::字符串名称,导出:: SaveFormat格式)方法保存带注释的 演示文稿。

以下是使用C ++将注释添加到特定PowerPoint幻灯片的示例代码。

// File pathsconst String sourceFilePath = u"SourceDirectory\SamplePresentation.pptx";const String outputFilePath = u"OutputDirectory\added-slide-notes.pptx";// Load the Presentation fileSharedPtrpresentation = MakeObject(sourceFilePath);SharedPtrnotesManager = presentation->get_Slides()->idx_get(0)->get_NotesSlideManager();// Add new slide notesSharedPtrnote = notesManager->AddNotesSlide();// Set the note textnote->get_NotesTextFrame()->set_Text(u"Test");// Save Presentation filepresentation->Save(outputFilePath, Aspose::Slides::Export::SaveFormat::Pptx);

使用C ++更新PowerPoint幻灯片的说明

要更新便笺,请使用INotesSlideManager检索现有便笺,然后更新便笺文本。以下是更新PowerPoint幻灯片的注释的步骤。

  • 首先,使用Presentation 类加载PowerPoint演示 文稿。
  • 访问INotesSlideManager使用用于特定的幻灯片> idx_get(int32_t指数) – – > get_NotesSlideManager()Presentation-> get_Slides()方法。
  • 使用INotesSlideManager-> get_NotesSlide()方法检索幻灯片注释。
  • 使用INotesSlide-> get_NotesTextFrame()-> set_Text(System :: String值)方法更新注释文本。
  • 最后,使用Presentation-> Save(系统::字符串名称,导出:: SaveFormat格式)方法将演示文稿与更新后的注释一起 保存。

以下是使用C ++更新PowerPoint幻灯片注释的示例代码。

// File pathsconst String sourceFilePath = u"SourceDirectory\slide-notes.pptx";const String outputFilePath = u"OutputDirectory\updated-slide-notes.pptx";// Load the Presentation fileSharedPtrpresentation = MakeObject(sourceFilePath);SharedPtrnotesManager = presentation->get_Slides()->idx_get(0)->get_NotesSlideManager();// Access slide notesSharedPtrnote = notesManager->get_NotesSlide();// Update the notesnote->get_NotesTextFrame()->set_Text(u"Test Updated");// Save Presentation filepresentation->Save(outputFilePath, Aspose::Slides::Export::SaveFormat::Pptx);

使用C ++从PowerPoint幻灯片中删除笔记

通过检索删除的滑动的音符 INotesSlideManager 用于该特定幻灯片,然后使用 RemoveNotesSlide() 方法。以下是从PowerPoint幻灯片中删除笔记的步骤。

  • 首先,使用Presentation 类加载PowerPoint演示 文稿。
  • 访问INotesSlideManager使用用于特定的幻灯片> idx_get(int32_t指数) – – > get_NotesSlideManager()Presentation-> get_Slides()方法。
  • 使用INotesSlideManager-> RemoveNotesSlide()方法删除注释。
  • 最后,使用Presentation-> Save(系统::字符串名称,导出:: SaveFormat格式)方法保存演示文件。

以下是使用C ++从PowerPoint幻灯片中删除注释的示例代码。

// File pathsconst String sourceFilePath = u"SourceDirectory\slide-notes.pptx";const String outputFilePath = u"OutputDirectory\removed-slide-notes.pptx";// Load the Presentation fileSharedPtrpresentation = MakeObject(sourceFilePath);SharedPtrnotesManager = presentation->get_Slides()->idx_get(0)->get_NotesSlideManager();// Remove slide notesnotesManager->RemoveNotesSlide();// Save Presentation filepresentation->Save(outputFilePath, Aspose::Slides::Export::SaveFormat::Pptx);

如果你想试用Aspose的全部完整功能,可联系在线客服获取30天临时授权体验。


还想要更多吗可以点击阅读【Aspose最新资源在线文库】查找需要的教程资源。如果您有任何疑问或需求,请随时加入Aspose技术交流群(),我们很高兴为您提供查询和咨询
标签:

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年3月11日
下一篇 2021年3月11日

相关推荐

发表回复

登录后才能评论