Aspose.Slides for C++

探索Aspose.Slides for C++优势,实现跨平台PowerPoint处理,支持多种格式转换与高效演示文稿操作,提升开发效率。

为什么选择 Aspose.Slides for C++?

与其他 PowerPoint 自动化解决方案相比,Aspose.Slides for C++ 具有许多优势,例如:

  • 跨平台兼容性:Aspose.Slides for C++ 支持多个平台。您可以在 Windows、Linux、macOS 和其他操作系统上使用 Aspose.Slides for C++。
  • 轻松集成和部署:Aspose.Slides for C++ 是一个独立的库,无需在您的系统上安装 Microsoft Office 或任何其他软件。您可以轻松地将 Aspose.Slides for C++ 与您现有的应用程序集成,并将其部署到任何服务器或云环境中。
  • 强大的特性和功能:Aspose.Slides for C++ 提供了一组丰富的特性和功能用于处理 PowerPoint 演示文稿,例如创建和修改幻灯片、添加和编辑形状、文本、图像、动画、过渡、图表、表格和其他元素、应用主题和布局、插入音频和视频、导出和打印演示文稿、导出到视频等等。
  • 高性能和高质量:Aspose.Slides for C++ 为 PowerPoint 演示文稿处理提供高性能和高质量的结果。您可以在几分钟内处理数千份演示文稿,而不会影响输出的保真度和准确性。
  • 免费试用和许可选项:Aspose.Slides for C++ 提供免费试用版,您可以下载并使用 30 天,没有任何限制。您还可以根据自身需求和预算选择各种许可选项,例如开发者许可、站点许可、OEM 许可和云许可。

高级 C++ PowerPoint 处理库功能


将演示文稿保存到文件或流

将演示文稿转换为标准格式

管理内置和自定义文档属性

密码保护演示文稿

添加、格式化和操作图表

添加、格式化和操作形状

添加、格式化和操作幻灯片

添加、格式化和处理文本

添加、格式化和操作表格

将演示文稿导出为 PDF 和 XPS

以 SVG 格式导出幻灯片

向演示文稿添加图像

将演示文稿导出为视频

向演示文稿添加信息图表

从数据库生成演示文稿

支持 MSO 2016 图表

将演示文稿导出为 HTML

在幻灯片中导入和导出 HTML 文本

向演示文稿添加布局幻灯片

加载受保护的演示文稿

设置单个图例的字体大小

创建股票图表并获取图表图像

更改系列颜色

设置图表区圆角边框

更改系列中类别的颜色

设置图表数据表的字体属性

支持的文件格式

Aspose.Slides for C++ 可以处理多种 PowerPoint 演示文稿文件格式,例如:

  • 输入格式:PPT、PPTX、PDF、ODP、OTP、POT、POTM、POTX、PPS、PPSM、PPSX、PPTM、FODP 等。
  • 输出格式:PPTX、PPT、PDF、HTML、PNG、BMP、JPG、FODP、GIF、ODP、OTP、POT、POTM、POTX、PPS、PPSM、PPSX、PPTM、SVG、TIFF 等。

您还可以将演示文稿与流和字节数组相互转换。

将 Powerpoint 文件导出为 PDF

Aspose.Slides for C++ 是一个功能强大的 C++ 库,用于创建和处理演示文稿文件。此外,它还提供了灵活的演示文稿转换为 PDF 的方法。使用Aspose.Slides for C++,任何开发人员或应用程序只需几行 C++ 代码即可将 Powerpoint 演示文稿转换为 PDF 文件。

将演示文稿转换为 PDF 的 C++ 代码

// Load the PPT. SharedPtr<Presentation> presentation = MakeObject<Presentation>(u"presentation.ppt"); // Save in PDF format. presentation->Save(u"document.pdf", Aspose::Slides::Export::SaveFormat::Pdf);

向演示文稿添加动画

在演示元素中添加动画可以使其更具互动性并吸引观众。

向 TextBox 添加动画的 C++ 代码

// Instantiates a presentation class that represents a presentation file. System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>();  System::SharedPtr<ISlide> sld = pres->get_Slides()->idx_get(0);  // Adds new AutoShape with text System::SharedPtr<IAutoShape> autoShape =     sld->get_Shapes()->AddAutoShape(Aspose::Slides::ShapeType::Rectangle, 20.0f, 20.0f, 150.0f, 100.0f);  System::SharedPtr<ITextFrame> textFrame = autoShape->get_TextFrame(); textFrame->set_Text(u"First paragraph \nSecond paragraph \n Third paragraph");  // Gets the main sequence of the slide. System::SharedPtr<ISequence> sequence = sld->get_Timeline()->get_MainSequence();  // Adds Fade animation effect to shape System::SharedPtr<IEffect> effect = sequence->AddEffect(autoShape, Aspose::Slides::Animation::EffectType::Fade,     Aspose::Slides::Animation::EffectSubtype::None, Aspose::Slides::Animation::EffectTriggerType::OnClick);  // Animates shape text by 1st level paragraphs effect->get_TextAnimation()->set_BuildType(Aspose::Slides::Animation::BuildType::ByLevelParagraphs1);  // Save the PPTX file to disk pres->Save(path + u"AnimText_out.pptx", Aspose::Slides::Export::SaveFormat::Pptx);

将 Powerpoint 幻灯片保存为图像

在某些情况下,可能需要将整个演示文稿转换为图像集合,这可以使用Aspose.Slides for C++来实现。

将演示文稿转换为一组图像有很多好处。例如,它可以帮助减小演示文稿的文件大小,使其更易于共享和存储。此外,它还可以确保演示文稿在不同设备和平台上的显示效果一致。当您想在不支持 PowerPoint 文件的文档或网页中添加幻灯片时,将演示文稿转换为图像也非常有用。最后,当您想将演示文稿制作成视频时,将演示文稿转换为图像也非常有用。

C++ 代码演示了如何将演示文稿转换为 JPG 图像。

使用自定义比例将演示文稿转换为 JPG 的 C++ 代码

auto pres = System::MakeObject<Presentation>(u"PowerPoint-Presentation.pptx");  // Defines dimensions int32_t desiredX = 1200, desiredY = 800; // Gets scaled values of X and Y float ScaleX = (float)(1.0 / pres->get_SlideSize()->get_Size().get_Width()) * desiredX; float ScaleY = (float)(1.0 / pres->get_SlideSize()->get_Size().get_Height()) * desiredY;  for (auto&& sld : pres->get_Slides()) {     // Creates a full scale image     System::SharedPtr<System::Drawing::Bitmap> bmp = sld->GetThumbnail(ScaleX, ScaleY);      // Saves the image to disk in JPEG format     bmp->Save(System::String::Format(u"Slide_{0}.jpg", sld->get_SlideNumber()),               System::Drawing::Imaging::ImageFormat::get_Jpeg()); }

将演示文稿转换为视频

可以使用Aspose.Slides for C++ API将 PowerPoint 演示文稿转换为视频

将演示文稿转换为视频格式有诸多益处。首先,它使演示文稿更容易被更广泛的受众接受,因为视频可以在各种设备和平台上播放,而无需 PowerPoint 软件。其次,视频比 PowerPoint 文件更易于分享,因为它们可以上传到 YouTube 等视频分享平台。第三,视频可以嵌入网站和博客,从而更轻松地与更多受众分享演示文稿。第四,视频可以用于培训,因为它们可以暂停和倒回以查看演示文稿的特定部分。最后,视频可以通过添加动画、过渡和背景音乐,使演示文稿更具吸引力。

将演示文稿转换为视频的 C++ 代码

void OnFrameTick(System::SharedPtr<PresentationPlayer> sender, System::SharedPtr<FrameTickEventArgs> args) {     System::String fileName = System::String::Format(u"frame_{0}.png", sender->get_FrameIndex());     args->GetFrame()->Save(fileName); }  void Run() {     auto presentation = System::MakeObject<Presentation>(u"PowerPoint-Presentation.pptx");      const int32_t fps = 33;      auto animationsGenerator = System::MakeObject<PresentationAnimationsGenerator>(presentation);     auto player = System::MakeObject<PresentationPlayer>(animationsGenerator, fps);     player->FrameTick += OnFrameTick;     animationsGenerator->Run(presentation->get_Slides());      const System::String ffmpegParameters = System::String::Format(         u"-loglevel {0} -framerate {1} -i {2} -y -c:v {3} -pix_fmt {4} {5}",         u"warning", m_fps, "frame_%d.png", u"libx264", u"yuv420p", "video.mp4");     auto ffmpegProcess = System::Diagnostics::Process::Start(u"ffmpeg", ffmpegParameters);     ffmpegProcess->WaitForExit(); }

了解有关 Aspose.Slides for C++ 的更多信息


产品推荐

  • 账号登录
社交账号登录