我對使用打開的docx-file有個小問題。 這是我的代碼部分:在python-docx中使用表格
doc = Document(self.fileName[0])
for paragraph in doc.paragraphs:
self.cursor.insertText(paragraph.text + '\n')
for table_index, table in enumerate(doc.tables):
self.cursor.insertText('Таблица {0}\n'.format(table_index+1))
for row_index in range(len(table.rows)):
for column_index in range(len(table.columns)):
self.cursor.insertText(table.cell(row_index, column_index).text + '\t')
self.cursor.insertText('\n')
self.cursor.insertText('\n')
問題是我可以找出表被放置physicaly在 原來的文檔? 我需要像doc中一樣按照相同的順序顯示段落和表格。
謝謝。來自鏈接的代碼完美無缺。 –