Jonathan Komar
Jonathan Komar

Reputation: 3096

Setting Table Border in Mircrosoft Word using AppleScript

When I try to set the line thickness of a table border, the result changes the line type to something undesired. Why is the line width parameter affecting the line style parameter? See the examples below and try them for yourself. I am using MS Office 2011 Word v14.2.3.

tell application "Microsoft Word"
    set line style of (get border selection which border border bottom) to line width225 point
    get line width of (get border selection which border border bottom)--test:results in line width150. Why? I just set it to line width225!

    --width25 = fine dots
    --width225 = cornered sine wave
    --width50 = dashed line
    --width75 = dash + 3 dots + dash
    --width100 = 3 lines
    --width150 = 2 lines
    --width300 = single
    --width450 = does not work
    --width600 = does not work
end tell

If I run this on a table which has the settings that I want, in order to see what they are:

tell application "Microsoft Word"
    get properties of (get border selection which border border bottom)
end tell

I get:

{class:border, visible:true, color index:no highlight, inside:false, line style:line style single, line width:line width225 point, art style:missing value, art width:missing value, color:{0, 0, 0}, color theme index:no theme color}

Which is correct. I should be able to copy those parameters to make my script work, but something happens when I try to set the line width (border thickness).

Upvotes: 1

Views: 655

Answers (1)

jackjr300
jackjr300

Reputation: 7191

If you want to change the line thickness, use line width instead of line style, otherwise it's normal that it doesn't do what you expect.

set line width of (get border selection which border border bottom) to line width225 point

If you want to change the line style, you should use a value from this list : ( line style none, line style single, line style dot, line style dash small gap, and many more ...)

Upvotes: 1

Related Questions