程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python office automation practice 09 | Python docx Library: the perfect combination of Python and word_ How to generate tables in word? Carry out Python office automation to the end

編輯:Python

One 、 Introduction to the topic

This section mainly demonstrates how to Word Create a table in the document and insert data , And make personalized settings for the table format .

Two 、 Special case effect

3、 ... and 、 Topic content

3.1 Create a table and assign values

In the use of Python-docx Package data entry for tables , The following methods are usually used .

There are two ways to assign values to cells in a table , One is directly for cell.text Attribute assignment , The other is to get or add paragraphs in cells , Then use text Attribute assignment implementation .

  • The basic syntax for creating tables :

The default table has no borders

table = document.add_table(1, 

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved