代码之家  ›  专栏  ›  技术社区  ›  Stu Thompson Helter Scelter

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

  •  0
  • Stu Thompson Helter Scelter  · 技术社区  · 16 年前

    1. 旋转三维图表1°
    2. 将图表另存为图像(png)

    从我在盘根上的发现来看,这似乎是可能的。但是AppleScript笨拙的冗长,以及web上缺少不起眼的msexcel 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
    

    ,但这是我所知道的。所谓“旋转”,我的意思是旋转图表对象本身,而不是图像。这可以通过“设置图表格式”对话框来完成。。。 MS Excel Dialog Box http://dietpizza.ch/images/3d-rotation-ms-excel-dialog-box.png

    通过操纵该值,图表对象将发生如下所示的变化:接下来的两幅图像(15° (效果)

    MS Excel 3D graph example 0 http://dietpizza.ch/images/3d-rotation-0.png MS Excel 3D graph example 1 http://dietpizza.ch/images/3d-rotation-1.png

    1 回复  |  直到 16 年前
        1
  •  3
  •   sakra    16 年前

    图表的X轴旋转可以通过AppleScript通过设置 rotation 财产 chart 财产 chart object

    下面的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
    
    推荐文章