MS Word paragraph tab (indenting) and styles

Hello again,
Once again Micro$oft is giving me a headache. I’m trying to write large paragraphs into a word document based on input from a script. I’ve figured out how to get the styles I need, but can get the indent to behave…

From the MS Word Applescript dictionary…

tab indent‚v : Sets the left indent for the specified paragraphs to a specified number of tab stops. Can also be used to remove the indent if the value of the count argument is a negative number.
tab indent paragraph/paragraph format
count integer : If positive, the number of tabs stops to indent or, if negative, the number of tab stops to remove from the indent.

So is the proper syntax…


tell paragraph format of selection to set tab indent to "3"
--or
tell paragraph format of selection to set tab indent to 3
-- neither seemed to work for me

I also found the right indent as a paragraph object in the dictionary…
(this paragraph needs to be centered in the document and indented approximately 1.5 inches from each side)

right indent (real) : Returns or sets the right indent in points for the specified paragraphs.

I’m not sure what value to put in for (real) and would greatly appreciate help on the syntax.

As always, I greatly appreciate any and all help.

  • Jim

Model: Late 2007 Macbook
AppleScript: 2.3 (118)
Browser: Safari 531.9
Operating System: Mac OS X (10.5)

After much digging, I found the answer…



tell application "Microsoft Word"
	activate
	tell paragraph format of selection to set style to style normal
			set paragraph format left indent of paragraph format of selection to (inches to points inches 1)
			set paragraph format right indent of paragraph format of selection to (inches to points inches 1)
			space 2 paragraph format of selection
			set alignment of paragraph format of selection to align paragraph justify
			type text selection text legal_text01
		end tell


This gives both the indents on left and right and justifies the paragraph without the outline style of the previous paragraph.

Hope someone else finds this useful.

  • Jim