Nalika pangembang ngowahi dokumen nganggo solusi C++ sing diwenehake, sing bener-bener diowahi yaiku Model Obyek Dokumen (DOM). Mangkono, meh kabeh owah-owahan bisa digawe kanggo document dituduhake minangka DOM. Kanthi C++ SDK sing disedhiyakake, pangembang bisa kanthi gampang nyunting dokumen: ngowahi teks, nganyari tabel, nambah gambar lan liya-liyane. Cukup muat Word, PDF utawa file ing format muat sing didhukung, gawe owah-owahan sing dibutuhake kanthi program lan ekspor asil menyang format nyimpen sing didhukung.
Pustaka C++ kita menehi pangembang kemampuan kanggo ngowahi dokumen kanthi langsung kanthi nyunting Document Object Model (DOM), tegese ora ana piranti lunak tambahan sing kudu diinstal.
Penting kanggo ngerti yen nggunakake solusi C++ iki, sampeyan bisa ngowahi dokumen ing format apa wae sing didhukung. Contone, sampeyan bisa mbukak file ing PDF, DOCX, DOC, RTF, ODT, EPUB, HTML lan format liyane, banjur ngowahi file iki lan disimpen ing format sing padha utawa ing format sing didhukung liyane.
Kasus sing paling populer kanggo nyunting Word, PDF utawa dokumen liyane yaiku nyunting teks. Kanthi solusi piranti lunak sing diwenehake, sampeyan bisa nambah, ngowahi utawa mbusak teks nggunakake C++ ing dokumen kasebut.
Pilihan panyuntingan dokumen populer liyane yaiku nyunting tabel. C++ SDK kita ngidini sampeyan nggarap tabel lan teks ing sel tabel.
Pangembang C++ bisa nambah utawa mbusak sel tabel lan tabel, uga nambah, ngowahi lan mbusak teks ing njero.
Saliyane nyunting teks lan tabel, ana pilihan umum liyane: nambahake gambar menyang dokumen ing C++. Pangembang C++ uga bisa nambah gambar menyang file nggunakake DOM.
Coba C++ SDK sing kuat iki lan evaluasi sawetara opsi ing panyuntingan dokumen. Nggunakake conto ing ngisor iki, muat dokumen sampeyan lan gawe sawetara owah-owahan: nambah teks, nambah tabel lan sel tabel kanthi teks utawa lebokake gambar menyang dokumen:
using namespace aspose::words::cloud;
auto config = std::make_shared<ApiConfiguration>(L"####-####-####-####-####",
L"##################");
auto wordsApi = std::make_shared<WordsApi>(config);
auto requestDocument = std::shared_ptr<std::istream>(new std::ifstream(
std::filesystem::path(L"Input.docx"), std::istream::binary));
auto requestParagraph = std::make_shared<aspose::words::cloud::models::ParagraphInsert>();
requestParagraph->setText(std::make_shared<std::wstring>(L"Morbi enim nunc faucibus a."));
std::shared_ptr<requests::InsertParagraphOnlineRequest> insertParagraphRequest(
new requests::InsertParagraphOnlineRequest(
requestDocument, requestParagraph
)
);
auto insertParagraph = wordsApi->insertParagraphOnline(insertParagraphRequest);
std::shared_ptr<requests::ConvertDocumentRequest> convertRequest(
new requests::ConvertDocumentRequest(
insertParagraph->document->values.begin,
std::make_shared<std::wstring>(L"docx")
)
);
auto convert = wordsApi->convertDocument(convertRequest);
using namespace aspose::words::cloud;
auto config = std::make_shared<ApiConfiguration>(L"####-####-####-####-####",
L"##################");
auto wordsApi = std::make_shared<WordsApi>(config);
auto requestDocument = std::shared_ptr<std::istream>(new std::ifstream(
std::filesystem::path(L"Input.docx"), std::istream::binary));
auto requestTable = std::make_shared<aspose::words::cloud::models::TableInsert>();
requestTable->setColumnsCount(std::make_shared<int32_t>(1));
requestTable->setRowsCount(std::make_shared<int32_t>(2));
std::shared_ptr<requests::InsertTableOnlineRequest> insertTableRequest(
new requests::InsertTableOnlineRequest(
requestDocument, requestTable, std::make_shared<std::wstring>(L"")
)
);
auto insertTable = wordsApi->insertTableOnline(insertTableRequest);
std::shared_ptr<requests::ConvertDocumentRequest> convertRequest(
new requests::ConvertDocumentRequest(
insertTable->document->values.begin,
std::make_shared<std::wstring>(L"docx")
)
);
auto convert = wordsApi->convertDocument(convertRequest);
using namespace aspose::words::cloud;
auto config = std::make_shared<ApiConfiguration>(L"####-####-####-####-####",
L"##################");
auto wordsApi = std::make_shared<WordsApi>(config);
auto requestDocument = std::shared_ptr<std::istream>(new std::ifstream(
std::filesystem::path(L"Input1.docx"), std::istream::binary));
auto requestDrawingObject =
std::make_shared<aspose::words::cloud::models::DrawingObjectInsert>();
requestDrawingObject->setHeight(std::make_shared<double>(0));
requestDrawingObject->setLeft(std::make_shared<double>(0));
requestDrawingObject->setTop(std::make_shared<double>(0));
requestDrawingObject->setWidth(std::make_shared<double>(0));
requestDrawingObject->setRelativeHorizontalPosition(
std::make_shared<aspose::words::cloud::models::DrawingObjectInsert::RelativeHorizontalPosition>(
aspose::words::cloud::models::DrawingObjectInsert::RelativeHorizontalPosition::MARGIN));
requestDrawingObject->setRelativeVerticalPosition(
std::make_shared<aspose::words::cloud::models::DrawingObjectInsert::RelativeVerticalPosition>(
aspose::words::cloud::models::DrawingObjectInsert::RelativeVerticalPosition::MARGIN));
requestDrawingObject->setWrapType(
std::make_shared<aspose::words::cloud::models::DrawingObjectInsert::WrapType>(
aspose::words::cloud::models::DrawingObjectInsert::WrapType::INLINE));
auto requestImageFile = std::shared_ptr<std::istream>(new std::ifstream(
std::filesystem::path(L"Input2.docx"), std::istream::binary));
std::shared_ptr<requests::InsertDrawingObjectOnlineRequest> insertDrawingObjectRequest(
new requests::InsertDrawingObjectOnlineRequest(
requestDocument, requestDrawingObject, requestImageFile,
std::make_shared<std::wstring>(L"sections/0")
)
);
auto insertDrawingObject = wordsApi->insertDrawingObjectOnline(insertDrawingObjectRequest);
std::shared_ptr<requests::ConvertDocumentRequest> convertRequest(
new requests::ConvertDocumentRequest(
insertDrawingObject->document->values.begin,
std::make_shared<std::wstring>(L"docx")
)
);
auto convert = wordsApi->convertDocument(convertRequest);
Klone Aspose.Words Cloud SDK for C++ kode sumber saka GitHub. Sampeyan bisa nemokake informasi rinci babagan mbangun lan ngonfigurasi SDK ing bagean "How to use the SDK".
Kanggo entuk kredensial keamanan sing dibutuhake lan ngakses REST API kanthi cepet, tindakake Instructions iki ing dokumentasi.
Deleng Repository Documentation kanggo ndeleng rincian.