开发者

get MSWord paragraph number via COM

开发者 https://www.devze.com 2023-02-17 11:37 出处:网络
开发者_如何学运维I process MSWord document with Python for paragraph in MSWord.Documents[0].ListParagraphs:
开发者_如何学运维

I process MSWord document with Python

for paragraph in MSWord.Documents[0].ListParagraphs:
    print(paragraph.ID+' '+paragraph.Range.Text.replace('\u206d','?')+'\n\n')

I Don't find how get MSWord paragraph number in API documentation cf. http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.paragraph_members

Any idea ?


Here you can find a VBA macro that finds the paragraph number, you could call it via COM


You could try:

print paragraph.Range.ListFormat.ListString
0

精彩评论

暂无评论...
验证码 换一张
取 消