0

Hello gurus:
I saw the discussion related on working with words with python which is:

import win32com.client
wordapp = win32com.client.Dispatch("Word.Application") # Create new Word Object
wordapp.Visible = 0 # Word Application should`t be visible
worddoc = wordapp.Documents.Add() # Create new Document Object
worddoc.PageSetup.Orientation = 1 # Make some Setup to the Document:
worddoc.PageSetup.LeftMargin = 20
worddoc.PageSetup.TopMargin = 20
worddoc.PageSetup.BottomMargin = 20
worddoc.PageSetup.RightMargin = 20
worddoc.Content.Font.Size = 11
worddoc.Content.Paragraphs.TabStops.Add (100)
worddoc.Content.Text = "Hello, I am a text!"
worddoc.Content.MoveEnd
worddoc.Close() # Close the Word Document (a save-Dialog pops up)
wordapp.Quit() # Close the Word Application

Now I wanted to know: are the values for margins in inches..? and how can I set the page width and height? also how chaan I cnge the font behaviors like font name, bold or italics the texts.?
I have important project where I have to work on word files using python. Please help me with the confusion.
Thanks.!

Edited by tirthajust4u

2
Contributors
1
Reply
24
Views
3 Years
Discussion Span
Last Post by bnn678
0

Right click on a webpage and inspect element, that might help you. You could also do this in pygame fairly simply.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.