翻譯|使用教程|編輯:胡濤|2022-07-22 10:14:01.200|閱讀 223 次
概述:本文將介紹如何使用 C++ 將 PowerPoint 演示文稿轉(zhuǎn)換為 Word 文檔,歡迎查閱!
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
在某些情況下,您有一個(gè) PowerPoint 演示文稿并想要?jiǎng)?chuàng)建一個(gè)詳細(xì)描述其內(nèi)容的文檔。為此,您可以將PPTX文件轉(zhuǎn)換為 Word 格式并修改 Word 文件以輸入每張幻燈片的詳細(xì)信息。在本文中,您將學(xué)習(xí)如何使用 C++ 以編程方式將 PowerPoint PPTX/PPT 文件轉(zhuǎn)換為 Word 格式。
為了將 PowerPoint 演示文稿轉(zhuǎn)換為 Word 文檔,我們將使用Aspose.Slides for C++和Aspose.Words for C++ APIs。前者是用于處理 PowerPoint 文件的 API,而后者用于創(chuàng)建、讀取和修改 Word 文檔。我們將使用 Aspose.Slides for C++ API 將 PowerPoint 文件轉(zhuǎn)換為 HTML 格式,并使用 Aspose.Words for C++ API 將生成的 HTML 轉(zhuǎn)換為 Word 格式。您可以通過 NuGet 安裝 API,也可以直接從“下載”部分下載它們。
PM> Install-Package Aspose.Slides.Cpp PM> Install-Package Aspose.Words.Cpp
以下是使用 C++ 將 PowerPoint PPTX/PPT 文件轉(zhuǎn)換為 DOCX 格式的步驟。
以下示例代碼展示了如何使用 C++ 將 PowerPoint PPTX/PPT 文件轉(zhuǎn)換為 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);
在本文中,您學(xué)習(xí)了如何使用 C++ 將 PowerPoint PPTX/PPT 文件轉(zhuǎn)換為 Word 文檔。我們使用 Aspose.Slides for C++ API 將 PPTX/PPT 文件轉(zhuǎn)換為 HTML 格式,使用 Aspose.Words for C++ API 將生成的 HTML 轉(zhuǎn)換為 DOCX 格式。要了解有關(guān)這些 API 的更多信息,您可以訪問它們的官方文檔。
歡迎下載|體驗(yàn)更多Aspose產(chǎn)品
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@ke049m.cn