Nalika pangembang ngowahi DOC dokumen nganggo perpustakaan Python iki, sing lagi diowahi yaiku Model Obyek Dokumen (DOM). Dadi, meh kabeh owah-owahan bisa ditindakake kanggo DOC dokumen sing diwakili minangka DOM. Kanthi Python SDK sing disedhiyakake, pangembang bisa kanthi gampang nyunting dokumen: ngowahi teks, nganyari tabel, nambah gambar lan liya-liyane. Cukup mbukak DOC, gawe owah-owahan sing dibutuhake kanthi program lan ekspor asil menyang format nyimpen sing padha utawa sing didhukung.
Pustaka Python kita menehi pangembang kemampuan kanggo ngowahi DOC dokumen kanthi langsung kanthi nyunting Document Object Model (DOM), tegese ora ana piranti lunak tambahan sing kudu diinstal.
Kasus sing paling populer kanggo nyunting DOC file yaiku nyunting teks. Kanthi solusi piranti lunak sing diwenehake, sampeyan bisa nambah, ngowahi utawa mbusak teks nggunakake Python ing dokumen kasebut.
Pilihan editing DOC liyane sing populer yaiku nyunting tabel. Python SDK kita ngidini sampeyan nggarap tabel lan teks ing sel tabel.
Pangembang Python bisa nambah utawa mbusak sel tabel lan tabel, uga nambah, ngowahi lan mbusak teks ing njero.
Saliyane nyunting teks lan tabel ing DOC, ana pilihan umum liyane: nambahake gambar menyang dokumen ing Python. Pangembang Python uga bisa nambah gambar menyang DOC file nggunakake DOM.
Coba Python SDK sing kuat iki lan evaluasi sawetara opsi ing panyuntingan DOC dokumen. Nggunakake conto ing ngisor iki, muat DOC dokumen lan gawe sawetara owah-owahan: nambah teks, nambah tabel lan sel tabel kanthi teks utawa lebokake gambar menyang DOC dokumen:
import asposewordscloud
words_api = WordsApi(client_id = '####-####-####-####-####',
client_secret = '##################')
request_document = open('Input.doc', 'rb')
request_paragraph = asposewordscloud.ParagraphInsert(text='Morbi enim nunc faucibus a.')
insert_paragraph_request = asposewordscloud.models.requests.InsertParagraphOnlineRequest(
document=request_document, paragraph=request_paragraph)
insert_paragraph = words_api.insert_paragraph_online(insert_paragraph_request)
convert_request = asposewordscloud.models.requests.ConvertDocumentRequest(
document=list(insert_paragraph.document.values())[0], format='doc')
convert = words_api.convert_document(convert_request)
import asposewordscloud
words_api = WordsApi(client_id = '####-####-####-####-####',
client_secret = '##################')
request_document = open('Input.doc', 'rb')
request_table = asposewordscloud.TableInsert(columns_count=1, rows_count=2)
insert_table_request = asposewordscloud.models.requests.InsertTableOnlineRequest(
document=request_document, table=request_table, node_path='')
insert_table = words_api.insert_table_online(insert_table_request)
convert_request = asposewordscloud.models.requests.ConvertDocumentRequest(
document=list(insert_table.document.values())[0], format='doc')
convert = words_api.convert_document(convert_request)
import asposewordscloud
words_api = WordsApi(client_id = '####-####-####-####-####',
client_secret = '##################')
request_document = open('Input1.doc', 'rb')
request_drawing_object = asposewordscloud.DrawingObjectInsert(
height=0, left=0, top=0, width=0, relative_horizontal_position='Margin',
relative_vertical_position='Margin', wrap_type='Inline')
request_image_file = open('Input2.doc', 'rb')
insert_drawing_object_request =
asposewordscloud.models.requests.InsertDrawingObjectOnlineRequest(
document=request_document, drawing_object=request_drawing_object,
image_file=request_image_file, node_path='sections/0')
insert_drawing_object = words_api.insert_drawing_object_online(insert_drawing_object_request)
convert_request = asposewordscloud.models.requests.ConvertDocumentRequest(
document=list(insert_drawing_object.document.values())[0], format='doc')
convert = words_api.convert_document(convert_request)
Instal Aspose.Words Cloud SDK for Python nggunakake repositori PyPi. pip install aspose-words-cloud kanggo nginstal SDK, banjur impor paket kasebut liwat import asposewordscloud. Minangka alternatif, sampeyan bisa kanthi manual clone Aspose.Words Cloud SDK for Python 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.
Sampeyan bisa nindakake operasi suntingan kanggo format file liyane: