翻譯|使用教程|編輯:胡濤|2022-07-22 10:14:01.200|閱讀 211 次
概述:本文將介紹如何使用 C++ 將 PowerPoint 演示文稿轉換為 Word 文檔,歡迎查閱!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
在某些情況下,您有一個 PowerPoint 演示文稿并想要創(chuàng)建一個詳細描述其內容的文檔。為此,您可以將PPTX文件轉換為 Word 格式并修改 Word 文件以輸入每張幻燈片的詳細信息。在本文中,您將學習如何使用 C++ 以編程方式將 PowerPoint PPTX/PPT 文件轉換為 Word 格式。
為了將 PowerPoint 演示文稿轉換為 Word 文檔,我們將使用Aspose.Slides for C++和Aspose.Words for C++ APIs。前者是用于處理 PowerPoint 文件的 API,而后者用于創(chuàng)建、讀取和修改 Word 文檔。我們將使用 Aspose.Slides for C++ API 將 PowerPoint 文件轉換為 HTML 格式,并使用 Aspose.Words for C++ API 將生成的 HTML 轉換為 Word 格式。您可以通過 NuGet 安裝 API,也可以直接從“下載”部分下載它們。
PM> Install-Package Aspose.Slides.Cpp PM> Install-Package Aspose.Words.Cpp
以下是使用 C++ 將 PowerPoint PPTX/PPT 文件轉換為 DOCX 格式的步驟。
以下示例代碼展示了如何使用 C++ 將 PowerPoint PPTX/PPT 文件轉換為 DOCX 格式。
// File paths const String sourceFilePath = u"SourceDirectory\\Slides\\SamplePresentation.pptx"; const String outputFilePath = u"OutputDirectory\\SlidesToWord_out.docx"; // Load the presentation file auto presentation = System::MakeObject<Aspose::Slides::Presentation>(sourceFilePath); // Create an instance of the MemoryStream class auto stream = System::MakeObject<MemoryStream>(); // Save the presentation to the stream presentation->Save(stream, SaveFormat::Html); stream->Flush(); stream->Seek(0, SeekOrigin::Begin); // Create an instance of the Document class using the stream auto doc = System::MakeObject<Aspose::Words::Document>(stream); // Save the Word document doc->Save(outputFilePath, Aspose::Words::SaveFormat::Docx);
在本文中,您學習了如何使用 C++ 將 PowerPoint PPTX/PPT 文件轉換為 Word 文檔。我們使用 Aspose.Slides for C++ API 將 PPTX/PPT 文件轉換為 HTML 格式,使用 Aspose.Words for C++ API 將生成的 HTML 轉換為 DOCX 格式。要了解有關這些 API 的更多信息,您可以訪問它們的官方文檔。
歡迎下載|體驗更多Aspose產品
本站文章除注明轉載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn