【问题标题】:How to use msoPattern constants to apply a pattern to a series in an Excel chart using Perl Win32::OLE如何使用 msoPattern 常量将模式应用于使用 Perl Win32::OLE 的 Excel 图表中的系列
【发布时间】:2012-08-30 22:42:25
【问题描述】:

我正在使用 Win32::OLE Perl 模块来更改图表中特定数据点的模式。

我可以这样做:

$chart->SeriesCollection(2)->Points(5)->{Interior}->{Pattern} = xlPatternUp;

例如。需要明确的是,这完全符合预期。 但是 xlPattern* 常量只允许 Excel 识别的模式子集。似乎在 msoPattern* 常量中指定了全套模式(至少我要使用的特定模式是)。

我尝试以相同的方式使用其中一个 msoPattern* 常量:

$chart->SeriesCollection(2)->Points(5)->{Interior}->{Pattern} =
msoPatternWideUpwardDiagonal;

但这没有任何效果。数据点将以“实心”(默认)模式呈现。 我已经确认我正确地导入了常量,例如:

use Win32::OLE::Const 'Microsoft Office 12.0 Object Library';

如何使用 msoPattern* 常量更改模式?

【问题讨论】:

    标签: perl excel design-patterns ole


    【解决方案1】:

    不幸的是,您似乎无法做您想做的事。

    如果您查看“应用于内部对象的模式属性”部分中的http://msdn.microsoft.com/en-us/library/office/aa224995,您会发现所有有效选项的列表。不幸的是,只有xlPattern 是有效的。

    【讨论】:

      【解决方案2】:

      可以通过{Format}->{Fill} 属性的Patterned 方法更改msoPatterns。

      例如

      $chart->SeriesCollection(2)->Points(5)-
      {Format}->Fill}->Patterned(msoPatternWideUpwardDiagonal);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-07-25
        • 2015-02-21
        • 2011-04-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-05-07
        • 1970-01-01
        相关资源
        最近更新 更多