2012-10-07 36 views
1

當我嘗試設置表格邊框的線條粗細時,結果會將線條類型更改爲不期望的內容。爲什麼線寬參數會影響線型參數?看下面的例子,併爲你自己嘗試。我正在使用MS Office 2011 Word v14.2.3。使用AppleScript在Mircrosoft Word中設置表格邊框

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 

如果我上了,我想設置的表上運行此,爲了看他們是什麼:

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

我得到:

{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} 

哪個是正確的。我應該能夠複製這些參數來使我的腳本工作,但是當我嘗試設置線寬(邊框厚度)時發生了一些情況。

回答

1

如果要更改線條粗細,請使用line width而不是line style,否則正常情況下它不符合您的預期。

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

如果你想改變line style,你應該從這個列表中使用的值:( 線型無,線條樣式單一,線條樣式點,線風格破折號小的差距,許多更多...)

+0

謝謝!我實際上注意到,今天沒有看到你的答案,我希望在有人看到它之前刪除我的問題......但不,你已經看到了它。好吧。謝謝:)希望這可以幫助有人下線。我想知道如何根據表格的寬度進行調整,但我會將其轉化爲另一個問題。 –