当前位置: 代码迷 >> 综合 >> python docx 查看问题
  详细解决方案

python docx 查看问题

热度:93   发布时间:2023-12-22 09:54:13.0

将生成的docx转成zip  重命名,然后查看里面的word/document.xml文件

if re.search(r'ddH2O',r_text):r_text = r_text.replace('ddH2O','')run = p_new.add_run()run.text = 'ddH'run.font.name = 'Arial'run.font.size = Pt(10)run.font.underline = Truerun = p_new.add_run()run.text = '2'run.font.subscript = Truerun.font.name = 'Arial'run.font.size = Pt(10)run.font.underline = Truerun = p_new.add_run()run.text = 'O'run.font.name = 'Arial'run.font.size = Pt(10)run.font.underline = Truerun = p_new.add_run()run.text = ' 'run.font.name = 'Arial'run.font.size = Pt(5)run.font.underline = True

文档中出现H2O