แก้ไข ข้อความ ใน Python SDK

ใช้ REST API เพื่อแก้ไข ข้อความ ใน Python โดยทางโปรแกรม

เมื่อนักพัฒนาแก้ไขเอกสาร ข้อความ ด้วยไลบรารี Python นี้ สิ่งที่กำลังแก้ไขจริงๆ คือ Document Object Model (DOM) ดังนั้น การเปลี่ยนแปลงเกือบทั้งหมดในเอกสาร ข้อความ ที่แสดงเป็น DOM ด้วย Python SDK ที่มีให้ นักพัฒนาสามารถแก้ไขเอกสารได้อย่างง่ายดาย เช่น แก้ไขข้อความ อัปเดตตาราง เพิ่มรูปภาพ และอื่นๆ เพียงโหลด ข้อความ ทำการเปลี่ยนแปลงที่จำเป็นโดยทางโปรแกรม และส่งออกผลลัพธ์เป็นรูปแบบเดียวกันหรือรูปแบบการบันทึกที่รองรับ

ดูข้อมูลโค้ด

แก้ไข ข้อความ ใน Python โดยใช้ REST API

ไลบรารี Python ของเราช่วยให้นักพัฒนาสามารถแก้ไขเอกสาร ข้อความ ได้โดยตรงโดยแก้ไข Document Object Model (DOM) ซึ่งหมายความว่าไม่จำเป็นต้องติดตั้งซอฟต์แวร์เพิ่มเติม

แก้ไขข้อความในไฟล์ ข้อความ โดยใช้ Python

กรณีที่นิยมที่สุดในการแก้ไขไฟล์ ข้อความ คือการแก้ไขข้อความ ด้วยโซลูชันซอฟต์แวร์ที่ให้มา คุณสามารถเพิ่ม แก้ไข หรือลบข้อความโดยใช้ Python ภายในเอกสารได้

แก้ไขตารางในไฟล์ ข้อความ โดยใช้ Python

อีกตัวเลือกการแก้ไข ข้อความ ยอดนิยมคือการแก้ไขตาราง Python SDK ของเราช่วยให้คุณทำงานกับตารางและข้อความในเซลล์ของตารางได้

นักพัฒนา Python สามารถเพิ่มหรือลบตารางและเซลล์ตาราง ตลอดจนเพิ่ม แก้ไข และลบข้อความภายใน

เพิ่มรูปภาพไปยังไฟล์ ข้อความ โดยใช้ Python

นอกจากการแก้ไขข้อความและตารางใน ข้อความ แล้ว ยังมีอีกตัวเลือกทั่วไป: การเพิ่มรูปภาพลงในเอกสารใน Python นักพัฒนา Python สามารถเพิ่มรูปภาพลงในไฟล์ ข้อความ โดยใช้ DOM

แก้ไข ข้อความ โดยทางโปรแกรม

ลองใช้ Python SDK อันทรงพลังนี้และประเมินตัวเลือกบางอย่างในการแก้ไขเอกสาร ข้อความ ใช้ตัวอย่างต่อไปนี้ โหลดเอกสาร ข้อความ ของคุณ และทำการเปลี่ยนแปลงบางอย่าง: เพิ่มข้อความ เพิ่มตารางและเซลล์ตารางที่มีข้อความ หรือแทรกรูปภาพลงในเอกสาร ข้อความ:

อัปโหลดเอกสารที่คุณต้องการแก้ไข
รันโค้ด
อัปโหลดรูปภาพที่คุณต้องการแทรก
เลือกรูปแบบเป้าหมายจากรายการ
import asposewordscloud

words_api = WordsApi(client_id = '####-####-####-####-####', 
   client_secret = '##################')

request_document = open('Input.txt', '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='txt')
convert = words_api.convert_document(convert_request)
import asposewordscloud

words_api = WordsApi(client_id = '####-####-####-####-####', 
   client_secret = '##################')

request_document = open('Input.txt', '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='txt')
convert = words_api.convert_document(convert_request)
import asposewordscloud

words_api = WordsApi(client_id = '####-####-####-####-####', 
   client_secret = '##################')

request_document = open('Input1.txt', '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.txt', '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='txt')
convert = words_api.convert_document(convert_request)
รันโค้ด
  
คัดลอกรหัส Python ไปยังคลิปบอร์ด

วิธีแก้ไข ข้อความ ใน Python

  1. ติดตั้ง 'Aspose.Words Cloud สำหรับ Python'
  2. เพิ่มการอ้างอิงไลบรารี (นำเข้าไลบรารี) ไปยัง Python โครงการของคุณ
  3. โหลด ข้อความ เพื่อแก้ไขใน Python
  4. แทรกเนื้อหาที่จุดเริ่มต้นของ ข้อความ
  5. ดาวน์โหลดเอกสารผลลัพธ์จากที่เก็บข้อมูลบนคลาวด์

Python ห้องสมุดเพื่อใช้ TXT แก้ไข

ติดตั้ง Aspose.Words Cloud SDK for Python โดยใช้ที่เก็บ PyPi เรียกใช้ pip install aspose-words-cloud เพื่อติดตั้ง SDK จากนั้นนำเข้าแพ็คเกจผ่าน import asposewordscloud คุณสามารถโคลน Aspose.Words Cloud SDK for Python ด้วยตนเองจาก GitHub และใช้ในโครงการของคุณ โปรดปฏิบัติตาม Instructions เหล่านี้เพื่อรับข้อมูลประจำตัวด้านความปลอดภัยที่จำเป็นอย่างรวดเร็วและเข้าถึง REST API ของเรา

ความต้องการของระบบ

อ้างถึง Repository Documentation เพื่อดูรายละเอียด

รูปแบบไฟล์อื่นๆ ที่รองรับ

คุณสามารถดำเนินการแก้ไขสำหรับรูปแบบไฟล์อื่นๆ ได้:

5%

สมัครสมาชิก Aspose Product Updates

รับจดหมายข่าวและข้อเสนอรายเดือนที่ส่งตรงถึงกล่องจดหมายของคุณ