Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Freez

macrumors newbie
Original poster
Feb 9, 2011
15
0
I am stuck on how to right align a column of a Microsoft Word table using applescript.

Any advice would be appreciated.

This doesn't work.

Code:
tell application "Microsoft Word"
	
	set txt to selection's text object
	set default table separator to tab
	set theResult to convert to table txt
	set myTable to table 1 of the active document
	auto fit behavior myTable behavior auto fit content
	set paragraph alignment of {myTable, column 3} to align paragraph right
end tell

osx 10.9.1, Microsoft Word for mac 2011 14.3.9, applescript 2.3
 
Last edited:
I am stuck on how to right align a column of a Microsoft Word table using applescript.

Any advice would be appreciated.

This doesn't work.

Code:
tell application "Microsoft Word"
	
	set txt to selection's text object
	set default table separator to tab
	set theResult to convert to table txt
	set myTable to table 1 of the active document
	auto fit behavior myTable behavior auto fit content
	set paragraph alignment of {myTable, column 3} to align paragraph right
end tell

osx 10.9.1, Microsoft Word for mac 2011 14.3.9, applescript 2.3

You can do something like this :

Code:
tell application "Microsoft Word"
	set myTable to table 1 of the active document
	repeat with i from 1 to count rows of myTable
		set alignment of paragraph format of text object of (get cell from table myTable row i column 3) to align paragraph right
	end repeat
end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.