翻譯|使用教程|編輯:李顯亮|2021-09-13 10:36:51.790|閱讀 244 次
概述:在本文中,將學習如何使用 C++ 以編程方式將 PowerPoint PPTX/PPT 文件轉換為 Word 格式。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
在某些情況下,您可能有一個 PowerPoint 演示文稿并希望創建一個詳細描述其內容的文檔。為此,可以將PPTX / PPT文件轉換為 Word 格式并修改 Word 文件以輸入每張幻燈片的詳細信息。在本文中,將學習如何使用 C++ 以編程方式將 PowerPoint PPTX/PPT 文件轉換為 Word 格式。
為了將 PowerPoint 演示文稿轉換為 Word 文檔,我們將使用Aspose.Slides for C++和Aspose.Words for C++ API。前者是用于處理 PowerPoint 文件的 API,而后者用于創建、讀取和修改 Word 文檔。我們將使用 Aspose.Slides for C++ API 將 PowerPoint 文件轉換為 HTML 格式,使用 Aspose.Words for C++ API 將生成的 HTML 轉換為 Word 格式。
以下是使用 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(sourceFilePath); // Create an instance of the MemoryStream class auto stream = System::MakeObject(); // 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(stream); // Save the Word document doc->Save(outputFilePath, Aspose::Words::SaveFormat::Docx);
如果你想試用Aspose的全部完整功能,可聯系在線客服獲取30天臨時授權體驗。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn