Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

Python Programming/MS Word

From Wikibooks, open books for an open world
<Python Programming

Microsoft Word documents of the .docx format can be created or changed using python-docx 3rd party module.

The .doc format can be worked with on Windows using PyWin32 via COM interface, provided Word is installed. An example:

importwin32com.clientwordapp=win32com.client.gencache.EnsureDispatch("Word.Application")# wordapp.Visible = Falseworddoc=wordapp.Documents.Open(r"C:\MyFile.doc")wdFormatHTML=8worddoc.SaveAs(r"C:\MyFile.html",FileFormat=wdFormatHTML)worddoc.ActiveWindow.Close()# wordapp.Application.Quit(-1) - No need to quit; Word quits when its last window is closed

External links

[edit |edit source]
Retrieved from "https://en.wikibooks.org/w/index.php?title=Python_Programming/MS_Word&oldid=3679115"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp