Kanthi solusi iki, Node pangembang bisa gampang nggawe DOC mung nganggo sawetara baris kode. Solusi kita bakal menehi sampeyan kabeh sing dibutuhake kanggo nggawe DOC nggunakake Node SDK.
Kanthi REST API, pangembang JavaScript bisa nggawe DOC dokumen kanthi gampang. Kanggo nggawe file ing DOC format dokumen, sampeyan kudu nindakake sawetara langkah nggunakake Node SDK:
Wiwit DOC dokumen kosong mesthine ngemot siji paragraf, nalika sampeyan nggawe DOC file kanthi program, sampeyan bakal entuk struktur dhasar kasebut.
Elinga yen sampeyan bisa nambah konten menyang DOC dokumen sing mentas digawe kanthi cepet. Mangkono, sampeyan bakal entuk ora mung DOC file kosong, nanging dokumen sing ngemot konten sing dibutuhake. Kanggo informasi luwih lengkap babagan cara ngowahi DOC dokumen, deleng kaca 'Edit DOC Document'.
Kaya sing wis kasebut, Node SDK kita ngidini sampeyan nggawe DOC dokumen kanthi program. Sampeyan bisa nyoba fungsi sing kuat lan ngevaluasi carane nggawe DOC file nggunakake conto JavaScript ing ngisor iki:
import * as fs from "fs";
const wordsApi = new WordsApi("####-####-####-####-####", "##################");
const fileName = "Output.doc";
const createDocumentRequest = new model.CreateDocumentRequest({
fileName: fileName
});
wordsApi.createDocument(createDocumentRequest)
.then((createDocumentRequestResult) => {
console.log("Result of CreateDocumentRequest: ", createDocumentRequestResult);
const downloadDocumentRequest = new model.DownloadFileRequest({
path: fileName
});
wordsApi.downloadFile(downloadDocumentRequest)
.then((downloadDocumentRequestResult) => {
console.log("Result of DownloadDocumentRequest: ", downloadDocumentRequestResult);
});
});
Instal 'Aspose.Words Cloud SDK for Node.js' nggunakake manajer paket NPM. npm install asposewordscloud --save saka baris perintah kanggo nginstal SDK liwat manajer paket NPM. Minangka alternatif, sampeyan bisa kanthi manual kloning Aspose.Words Cloud SDK for Node.js saka GitHub lan nggunakake ing project. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.
Deleng Repository Documentation kanggo ndeleng rincian liyane.