Nalika pangembang ngowahi dokumen nganggo solusi PHP sing diwenehake, sing bener-bener diowahi yaiku Model Obyek Dokumen (DOM). Mangkono, meh kabeh owah-owahan bisa digawe kanggo document dituduhake minangka DOM. Kanthi PHP 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 PHP 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 PHP 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 PHP ing dokumen kasebut.
Pilihan panyuntingan dokumen populer liyane yaiku nyunting tabel. PHP SDK kita ngidini sampeyan nggarap tabel lan teks ing sel tabel.
Pangembang PHP 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 PHP. Pangembang PHP uga bisa nambah gambar menyang file nggunakake DOM.
Coba PHP 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:
use Aspose\Words\WordsApi;
$wordsApi = new WordsApi('####-####-####-####-####', '##################');
$requestDocument = "Input.docx";
$requestParagraph = new ParagraphInsert(array(
"text" => "Morbi enim nunc faucibus a.",
));
$insertParagraphRequest = new InsertParagraphOnlineRequest(
$requestDocument, $requestParagraph, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
);
$insertParagraph = $wordsApi->insertParagraphOnline($insertParagraphRequest);
$convertRequest = new ConvertDocumentRequest(
array_key_first($insertParagraph->document()->values()), "docx", NULL, NULL, NULL, NULL
);
$convert = $wordsApi->convertDocument($convertRequest);
use Aspose\Words\WordsApi;
$wordsApi = new WordsApi('####-####-####-####-####', '##################');
$requestDocument = "Input.docx";
$requestTable = new TableInsert(array(
"columns_count" => 1,
"rows_count" => 2,
));
$insertTableRequest = new InsertTableOnlineRequest(
$requestDocument, $requestTable, "", NULL, NULL, NULL, NULL, NULL, NULL
);
$insertTable = $wordsApi->insertTableOnline($insertTableRequest);
$convertRequest = new ConvertDocumentRequest(
array_key_first($insertTable->document()->values()), "docx", NULL, NULL, NULL, NULL
);
$convert = $wordsApi->convertDocument($convertRequest);
use Aspose\Words\WordsApi;
$wordsApi = new WordsApi('####-####-####-####-####', '##################');
$requestDocument = "Input1.docx";
$requestDrawingObject = new DrawingObjectInsert(array(
"height" => 0,
"left" => 0,
"top" => 0,
"width" => 0,
"relative_horizontal_position" => "Margin",
"relative_vertical_position" => "Margin",
"wrap_type" => "Inline",
));
$requestImageFile = "Input2.docx";
$insertDrawingObjectRequest = new InsertDrawingObjectOnlineRequest(
$requestDocument, $requestDrawingObject, $requestImageFile, "sections/0", NULL,
NULL, NULL, NULL, NULL, NULL
);
$insertDrawingObject = $wordsApi->insertDrawingObjectOnline($insertDrawingObjectRequest);
$convertRequest = new ConvertDocumentRequest(
array_key_first($insertDrawingObject->document()->values()), "docx", NULL, NULL, NULL, NULL
);
$convert = $wordsApi->convertDocument($convertRequest);
Instal 'Aspose.Words Cloud SDK for PHP' saka gudang Packagist. Mung mbukak composer require aspose-cloud/aspose-words-cloud kanggo nginstal SDK, banjur gunakake require_once('vendor/autoload.php'); kanggo ngimpor menyang proyek sampeyan.
Minangka alternatif, sampeyan bisa kanthi manual kloning Aspose.Words Cloud SDK for PHP saka GitHub. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.
PHP 7.1 utawa luwih anyar
Deleng Repository Documentation kanggo ndeleng rincian liyane.