The following code
#!/usr/bin/python
# coding:utf-8
import docx
def main():
filepath = 'test.docx'
filepath1 = 'wtest.docx'
newdocx = docx.Document(filepath)
table = newdocx.tables
for oTable in table:
rows_num = len(oTable.rows)
columns_num = len(oTable.columns)
cell = oTable.cell(3, 0)
# cell.add_paragraph("a")
cell.text = ""
cell.paragraphs[-1].runs[0].add_picture('t1.jpg')
print(rows_num)
print(columns_num)
newdocx.save(filepath1)
if __name__ == '__main__':
main()
Read More:
- Content rendering error: a solution to the problem of zero Download document cannot be opened
- XML file should have root tag (extra content at the end of the document in file error)
- Solving word experienced an error trying to open the file in word
- JS error: permission denied to access property ‘document’— document.domain -The same source strategy of JavaScript
- Pre initialization of list content and length in Python
- Python implements inserting content in the specified position of text
- Python Anaconda Spyder can’t display pictures by using Matplotlib. Error report solution: figures now render in the plots pane by default. To mak
- Use Python to insert the specified content in the specified line of the specified file
- FreeMarker generates word file, and word file cannot open the solution.
- Several common methods of inserting pictures into latex documents
- Cisco ASA prompt modifies the display name hostname priority state context
- Keyerror occurred when openpyxl copied some excel with pictures:. MPO‘
- Bash modifies the file names in the specified folder through MAC terminal (batch modification)
- Solution for GitHub unable to open pictures
- Springboot modifies the reference of the application.yml or. Properties file to report an error after startup
- Solve the problem that “figure size 640×480 with 1 axes” does not display pictures in jupyter notebook
- How to Compress them with thumbrails When uploading pictures
- Causes and solutions of WordPress media library pictures not showing or showing errors
- How to align MathType formula with text in word
- Nginx modifies the front end request size limit (413 request entity too large)