我有几个word文件,每个都有特定的内容。我希望有一个片段能告诉我或帮助我找出如何在使用Python
docx
库的情况下将这些word文件合并成一个文件。
例如,在pywin32库中我做了以下工作。
rng = self.doc.Range(0, 0)
for d in data:
time.sleep(0.05)
docstart = d.wordDoc.Content.Start
self.word.Visible = True
docend = d.wordDoc.Content.End - 1
location = d.wordDoc.Range(docstart, docend).Copy()
rng.Paste()
rng.Collapse(0)
rng.InsertBreak(win32.constants.wdPageBreak)
但我需要在使用Python的docx库而不是win32.client时进行。