DOCX ドキュメントを読み取るタスクは、DOMモデル内の階層データ構造を読み取るタスクです。これは、考えられるすべての子要素と属性を含む、個々の DOCX データ要素の形式を知っていることを意味します。
C++ ライブラリはクラウドベースのソリューションであり、DOCX ファイルを開いて簡単に読み書きできます。この分散アプローチにより、リソースを大量に消費するすべての DOCX ドキュメント処理がAsposeサーバーで実行されるため、C++ 言語を使用したソフトウェア開発に柔軟性がもたらされます。必要なのは、C++ コードでCloud APIにアクセスするための秘密鍵を取得することだけです。
DOCX ドキュメントのすべての要素を反復処理することも、DOMツリーで特定の要素を検索することもできます。 DOCX ファイルの構造とドキュメントノードに含まれるデータの両方を操作するための幅広い C++ 関数を提供します。
次のコード例は、C++ を使用して DOCX ファイルをロードし、そのファイルに対していくつかのアクションを実行する方法をすばやく理解するのに役立ちます。
using namespace aspose::words::cloud;
auto config = std::make_shared<ApiConfiguration>(L"####-####-####-####-####",
L"##################");
auto wordsApi = std::make_shared<WordsApi>(config);
std::wstring fileName = L"Input.docx";
auto requestFileContent = std::shared_ptr<std::istream>(
new std::ifstream(
std::filesystem::path(getFileTextUtf16(fileName)), std::istream::binary));
std::shared_ptr<requests::UploadFileRequest> uploadDocumentRequest(
new requests::UploadFileRequest(
requestFileContent, std::make_shared<std::wstring>(fileName)
)
);
wordsApi->uploadFile(uploadDocumentRequest);
auto requestParagraph = std::make_shared<aspose::words::cloud::models::ParagraphInsert>();
requestParagraph->setText(std::make_shared<std::wstring>(
L"Reading and writing to the file in the cloud occurs automatically."));
std::shared_ptr<requests::InsertParagraphRequest> insertParagraphRequest(
new requests::InsertParagraphRequest(
std::make_shared<std::wstring>(fileName), requestParagraph
)
);
wordsApi->insertParagraph(insertParagraphRequest);
std::shared_ptr<requests::DownloadFileRequest> downloadDocumentRequest(
new requests::DownloadFileRequest(
std::make_shared<std::wstring>(fileName)
)
);
wordsApi->downloadFile(downloadDocumentRequest);
GitHub Aspose.Words Cloud SDK for C++ クローンを作成します。 SDKの構築と構成の詳細については、 "How to use the SDK" セクションを参照してください。
必要なセキュリティクレデンシャルをすばやく取得してRESTAPIにアクセスするには、ドキュメントの次の Instructions に従ってください。
詳細については、 Repository Documentation を参照してください。