python-docx 处理导出word有段前距离段后距离的问题

# 设置与下一段间隔 Pt(0)
# paragraph_format.space_before = Pt(0)
# paragraph_format.right_indent = Pt(0)
rn = p_new.add_run(r_text,r.style)
self.copyFont(r, rn)
rn.font.name = 'Arial'
rn.font.size = Pt(10)

 

# # 设置与上一段间隔 Pt(0)
paragraph_format = p_new.paragraph_format
# paragraph_format.alignment = WD_PARAGRAPH_ALIGNMENT.JUSTIFY
# paragraph_format.space_after = Pt(0)
# paragraph_format.left_indent = Pt(0)
# paragraph_format.space_before = Pt(0)
# paragraph_format.right_indent = Pt(0)
rn = p_new.add_run(r_text,r.style)
self.copyFont(r, rn)
rn.font.name = 'Arial'
rn.font.size = Pt(10)

都没有作用 原因是提哦换的r_text中手动添加了\n

 

    _5arm_seq_f_all += _5arm_seq_f + '\n'  #去掉
    _5arm_seq_r_all += _5arm_seq_r + '\n'
if re.search(r'@primer_enzyme._5arm.primer_info.primer_seq_f', r.text):
    r_text = r.text.replace('@primer_enzyme._5arm.primer_info.primer_seq_f', _5arm_seq_f_all)

去掉标记行的\n

相关文章:

  • 2022-12-23
  • 2021-12-02
  • 2021-11-20
  • 2022-12-23
猜你喜欢
  • 2022-02-05
  • 2021-08-11
  • 2021-11-26
  • 2022-12-23
  • 2021-12-02
  • 2022-02-05
相关资源
相似解决方案