Python-docx和计数选项卡

时间:2019-02-19 08:24:40

标签: python ms-word tabs docx python-docx

任何人都可以帮助我计算docx文件中一行的选项卡数量。我想知道创建层次结构的标签数量,例如一个标签为1),两个标签为1.1),三个标签为1.1.1),等等。

我正在使用Python 3的库python-docx。

from docx import *

document = Document('Sample.docx')

for paragraph in document.paragraphs:

  for run in paragraph.runs:

     #Count the number of tabs in a line of text

谢谢。

0 个答案:

没有答案