上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页
摘要: from docx import Document w=Document(r'F:\word练习\表格.docx') #删除表 print(len(w.tables)) t=w.tables[0] t._element.getparent().remove(t._element) print(len 阅读全文
posted @ 2020-07-04 22:42 马蹄哒哒 阅读(183) 评论(0) 推荐(0)
摘要: from docx import Document w=Document(r'F:\word练习\表格.docx') table_1=w.tables[0] #删除行 print(len(table_1.rows)) row2=table_1.rows[1] row2._element.getpar 阅读全文
posted @ 2020-07-04 22:34 马蹄哒哒 阅读(384) 评论(0) 推荐(0)
摘要: from docx import Document from docx.shared import Cm w=Document(r' ') w.tables[0].add_row() #给表格增加一行 w.tables[0].add_column(Cm(5)) #给表哥增加一列 print(len( 阅读全文
posted @ 2020-07-03 11:36 马蹄哒哒 阅读(760) 评论(0) 推荐(0)
摘要: from docx import Document w=Document(r'F:\word练习\a.docx') t=\ [ ['姓名','性别','年龄'], ['张三','男',23], ['李四','女',45], ['王五','男',60] ] r=4;c=3 table=w.add_ta 阅读全文
posted @ 2020-07-03 11:25 马蹄哒哒 阅读(154) 评论(0) 推荐(0)
摘要: from docx.enum.text import WD_PARAGRAPH_ALIGNMENT from docx import Document w=Document(r'文件路径') picture=w.paragraphs[1].add_run().add_picture(r'') w.p 阅读全文
posted @ 2020-07-03 11:11 马蹄哒哒 阅读(712) 评论(0) 推荐(0)
摘要: from docx import Document w=Document(r'F:\word练习\a.docx') pic1=w.paragraphs[1].add_run().add_picture(r'F:\word练习\a.jpg') #第二张图片与第一张图片高度的比例 pic2=w.para 阅读全文
posted @ 2020-07-02 13:39 马蹄哒哒 阅读(347) 评论(0) 推荐(0)
摘要: from docx import Document w=Document(r'F:\word练习\ss.docx') paragraph=w.paragraphs[1] print('删除前图片的数量:',len(w.inline_shapes)) paragraph.clear() print(' 阅读全文
posted @ 2020-07-02 11:56 马蹄哒哒 阅读(155) 评论(0) 推荐(0)
摘要: from docx import Document from docx.shared import Cm w=Document(r'F:\word练习\qq.docx') run=w.tables[0].cell(0,0).paragraphs[0].add_run() run.add_pictur 阅读全文
posted @ 2020-07-02 11:48 马蹄哒哒 阅读(136) 评论(0) 推荐(0)
摘要: from docx import Document word=Document(r'F:\word练习\qq.docx') word.add_page_break() word.add_heading('自我介绍',level=1) 正文=word.add_paragraph('我是正文,名叫李昊' 阅读全文
posted @ 2020-07-02 00:16 马蹄哒哒 阅读(293) 评论(0) 推荐(0)
摘要: >>> c=Document(r'F:\word练习\指定段落.docx') >>> c <docx.document.Document object at 0x00000203B8F3C240> >>> len(c.paragraphs) 5 >>> w=c.paragraphs[1] >>> w 阅读全文
posted @ 2020-07-02 00:15 马蹄哒哒 阅读(243) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页