Office Update 16.9.0 Word中的Applescript问题

时间:2018-01-23 22:03:37

标签: ms-word applescript word-vba-mac

我公司使用Applescript为用户管理MS Word文档。安装最近的16.9.0更新后,许多用户开始遇到涉及页码的问题。经过一番调查后,我发现罪魁祸首是一段Applescript,它将页码放在给定文档Section的第一页的标题中。这是一个例子:

tell application "/Applications/Microsoft Word.app"
set myHeader to get header section 1 of active document index header footer first page
make new page number at myHeader with properties {alignment:align page number right}
end tell

这段代码已经运行了一年多,所以我非常有信心这次更新至少部分引起了它。我通过将页码设置为主标题而找到了解决此问题的方法,如下所示:

tell application "/Applications/Microsoft Word.app"
set myHeader to get header section 1 of active document index header footer primary
make new page number at myHeader with properties {alignment:align page number right}
end tell

这不是一个理想的解决方案,但它有效。然而,现在我已经注意到,无论我尝试什么对齐,并给出页码,它始终保持对齐。这对我们的情况是不可接受的,并且似乎需要在Applescript之外的完整解决方法。

有没有其他人在16.9.0更新后遇到过Applescript和Word的这种或任何其他奇怪的行为?有关如何使用Applescript以其他方式使页码对齐的任何想法?

1 个答案:

答案 0 :(得分:0)

我也有同样的问题。我做了一些调试,看起来“页脚”类中“页码”的“对齐”属性不再存在,这可以解释为什么所有内容都默认为左对齐。当我尝试调试它时,下面是我的脚本的结果。我记录了页码计数以显示页码存在,但是当我尝试记录“alignment”属性时,它显示为(缺失值)。

https://i.imgur.com/VgcQN3I.png

如果有人可以帮忙解决这个问题,那就太好了。现在我只需手动将页码拖放到正确的位置或手动插入。谢谢你提前。