這個 C++ 庫為開發人員提供了一個功能強大的 API 來以編程方式編輯 Word、PDF 文檔。輕鬆將文檔修改功能集成到您的軟件中。我們的解決方案支持在 C++ 中編輯 PDF, DOCX, DOC, RTF, ODT, EPUB, HTML 和許多其他文件格式。
在 C++ 中以編程方式編輯文檔的任務是修改文檔樹中的元素。它也被稱為"DOM"--用於與文檔元素及其屬性交互的編程模型。
複雜數據結構的編輯功能離不開高級搜索功能。為了確保最高級別的靈活性,我們的庫為 C++ 開發人員提供了正則表達式搜索功能。這種方法擴展了編輯文本的可能性,允許使用模板進行動態內容修改。
Word 和 PDF 文檔的編程修改是數字工作流程的一個組成部分。在 PDF、 Word 中編輯文本,修改表格,使用外部數據插入圖表。
C++ 庫是編輯文檔的獨立解決方案,無需安裝 Microsoft Word 或 Acrobat Reader。它已準備好用於工業用途,並提供修改 Word、PDF 和其他文件格式的全方位操作:
最需要的功能之一是 Word 和 PDF 文檔中的動態表格生成和表格修改。使用 C++ 庫可以輕鬆處理表格:在 C++ 代碼中編輯表格、更新表格和提取表格文本。
以下示例顯示瞭如何在 C++ 代碼中更改 Word 文檔:
dotnet add package Aspose.Words.Cpp
複製
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.docx");
auto builder = MakeObject<DocumentBuilder>(doc);
// 在文檔開頭插入文本。
builder->MoveToDocumentStart();
builder->Writeln(u"Morbi enim nunc faucibus a.");
doc->Save(u"Output.docx");
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.docx");
auto builder = MakeObject<DocumentBuilder>(doc);
// 在文檔開頭插入表格。
builder->MoveToDocumentStart();
builder->StartTable();
builder->InsertCell();
builder->Write(u"Row 1, cell 1.");
builder->InsertCell();
builder->Write(u"Row 1, cell 2.");
builder->EndTable();
doc->Save(u"Output.docx");
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.docx");
auto builder = MakeObject<DocumentBuilder>(doc);
// 在文檔開頭插入圖片。
builder->MoveToDocumentStart();
builder->InsertImage(u"Image.png");
doc->Save(u"Output.docx");
有三個選項可以將 Aspose.Words for C++ 安裝到您的開發人員環境中。請選擇符合您需求的一種,並按照分步說明進行操作:
您可以使用這個 C++ 庫在 Microsoft Windows 、Linux 和 macOS 操作系統上開發軟件:
如果您為 Linux 或 macOS 開發軟件,請查看產品文檔中 fontconfig 和 mesa-glu 開源包)的信息。