PNG JPG BMP TIFF PPT
Aspose.Slides  for C++

在 C++ 中解析 PPT 格式

使用 C++ API 的服务器端 Aspose.Slides 进行本机和高性能 PPT 文档解析,无需使用 Microsoft 或 Adob​​e PDF 等任何软件。

如何使用 C++ 解析 PPT 文件

为了解析 PPT 文件,我们将使用

Aspose.Slides for C++

API 是一个功能丰富、功能强大且易于使用的 C++ 平台文档解析 API。可以直接下载最新版本,直接打开

NuGet

包管理器,搜索 Aspose.Slides.Cpp 并安装。您也可以从包管理器控制台使用以下命令。

命令


PM> Install-Package Aspose.Slides.Cpp

在 C++ 中解析 PPT 文件的步骤

使用 Aspose.Slides for C++ API 解析基本文档只需几行代码即可完成。

  1. 加载 PPT 文件。

  2. 获取第一张幻灯片的 ITextFrame 对象数组。

  3. 循环遍历 TextFrames 数组

  4. 循环浏览当前 ITextFrame 中的段落。

  5. 循环遍历当前 IParagraph 中的部分。

  6. 显示文本。

系统要求

Aspose.Slides for C++ 支持所有主要平台和操作系统。请确保您具有以下先决条件。

  • Microsoft Windows 或具有适用于 Windows 32 位、Windows 64 位和 Linux 64 位的 C++ 运行时环境的兼容操作系统。
  • 项目中引用的 C++ DLL 的 Aspose.Slides。
 

解析 PPT 文件 - C++

// Sample file path
const String sourceFilePath = u"SourcePath\sourceFile.ppt";

// Load the PPT file
SharedPtr<Presentation> presentation = MakeObject<Presentation>(sourceFilePath);

// Get an Array of ITextFrame objects from the first slide
System::ArrayPtr<SharedPtr<ITextFrame>> textFramesSlideOne = SlideUtil::GetAllTextBoxes(presentation->get_Slides()->idx_get(0));

// Loop through the Array of TextFrames
for (int i = 0; i get_Length(); i++){
	// Loop through paragraphs in current ITextFrame
	for (SharedPtr<IParagraph> paragraph : textFramesSlideOne[i]->get_Paragraphs()){
		// Loop through portions in the current IParagraph
		for (SharedPtr<IPortion> portion : paragraph->get_Portions()){
			// Display text
			Console::WriteLine(portion->get_Text());
		}
	}
}  

    
 
  • 关于 Aspose.Slides for C++ API

    Aspose.Slides API 可用于读取、编写、操作 Microsoft PowerPoint 文档并将其转换为 PDF、XPS、HTML、TIFF、ODP 和各种其他格式。可以从头开始创建新文件并将其保存为相关支持的格式。 Aspose.Slides 是一个独立的 API,用于创建、解析或操作演示文稿、幻灯片和元素,它不依赖于 Microsoft 或 OpenOffice 等任何软件。

    Online PPT Parser Live Demos

    Extract text and images from PPT documents right now by visiting our Live Demos website . The live demo has the following benefits

      No need to download Aspose API.
      No need to write any code.
      Just upload your PPT files.
      It will be parsed instantly.

    PPT 什么是PPT文件格式

    A file with PPT extension represents PowerPoint file that consists of a collection of slides for displaying as SlideShow. It specifies the Binary File Format used by Microsoft PowerPoint 97-2003. A PPT file can contain several different types of information such as text, bulleted points, images, multimedia and other embedded OLE objects. Microsoft came up with newer file format for PowerPoint, known as PPTX, from 2007 onwards that is based on Office OpenXML and is different from this binary file format. Several other application programs such as OpenOffice Impress and Apple Keynote can also create PPT files.

    阅读更多

    其他支持的解析文档

    使用 C++,可以轻松解析其他格式,包括。

    ODP (OpenDocument 演示格式)
    PPTX (打开 XML 表示格式)