Get started with python word and pythonword

Source: Internet
Author: User

Get started with python word and pythonword

1. Install pywin32

Http://sourceforge.net/projects/pywin32

Find the python version suitable for you in files. As of this article, the latest version is the pywin32-219 shortcut path:

Http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/

After the installation, restart the Operating System. Otherwise, the system reports an error and the win32api cannot be found.

2. Simple use

Import win32comfrom win32com. client import Dispatch, constantswordApp = win32com. client. dispatch ('word. application ') # Run in the background, displayed, without warning wordApp. visible = TruewordApp. displayAlerts = 0 # create a new document doc = wordApp. documents. add () # insert text doc. paragraphs. last. range. text = 'Hello! '

# Save the file doc. SaveAs ('d: // say_hello.docx ')

Because the word api is used, all call methods are consistent. If you don't want to read documents on the Microsoft official website, the simplest way is to search for articles such as c # word and read them.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.