如何在数据标签 C# 中使用模式 属性
How to use pattern property in data-label C#
我正在尝试塑造 excel data label using C#. But I din't know about FillFormat.Pattern。
任何人都可以帮助我,如何使用它并塑造 Excel 数据标签。
我们将不胜感激。
这是我目前所做的。
System.Collections.IEnumerator iEChartSeries = seriesCollection.GetEnumerator();
if(iEChartSeries.MoveNext()){
var oSeries = (Excel.Series)(iEChartSeries.Current);
Excel.Points pts = (Excel.Points) oSeries.Points(Type.Missing);
System.Collections.IEnumerator iPoints = pts.GetEnumerator();
while(iPoints.MoveNext())
{
var pt = (Excel.Point)(iPoints.Current);
pt.HasDataLabel = true;
pt.DataLabel.Position = Excel.XlDataLabelPosition.xlLabelPositionAbove;
pt.DataLabel.Font.Name = "Arial";
pt.DataLabel.Font.FontStyle = "Bold";
pt.DataLabel.Font.Size = 8;
pt.DataLabel.Text = "N";
pt.DataLabel.Format.Fill.Patterned = ??;// how to get circle/ triangle/ square shapes
}
}
Patterned
是一种方法,您可以将所需的模式传递给该方法。它用于设置 ReadOnly 属性 .Pattern
语法应根据记录的模式化方法 here:
pt.DataLabel.Format.Fill.Patterned( msoPatternZigZag );
列出了要传递的不同选项here
我相信此 UI method is achieved with the AutoShapeType
property, not Fill
. See this post 的自动化并阅读了@SiddharthRout 赢得赏金的答案。
对于您的代码,请替换此行:
pt.DataLabel.Format.Fill.Patterned = ??
有
pt.DataLabel.Format.AutoShapeType = 105;
105 是 msoShapeRectangularCallout
。我从您对其他答案的评论中注意到,您可能没有引用 Microsoft.Office.Core
名称空间,其中 enumeration lives. The magic numbers are here.
HTH
我正在尝试塑造 excel data label using C#. But I din't know about FillFormat.Pattern。
任何人都可以帮助我,如何使用它并塑造 Excel 数据标签。 我们将不胜感激。
这是我目前所做的。
System.Collections.IEnumerator iEChartSeries = seriesCollection.GetEnumerator();
if(iEChartSeries.MoveNext()){
var oSeries = (Excel.Series)(iEChartSeries.Current);
Excel.Points pts = (Excel.Points) oSeries.Points(Type.Missing);
System.Collections.IEnumerator iPoints = pts.GetEnumerator();
while(iPoints.MoveNext())
{
var pt = (Excel.Point)(iPoints.Current);
pt.HasDataLabel = true;
pt.DataLabel.Position = Excel.XlDataLabelPosition.xlLabelPositionAbove;
pt.DataLabel.Font.Name = "Arial";
pt.DataLabel.Font.FontStyle = "Bold";
pt.DataLabel.Font.Size = 8;
pt.DataLabel.Text = "N";
pt.DataLabel.Format.Fill.Patterned = ??;// how to get circle/ triangle/ square shapes
}
}
Patterned
是一种方法,您可以将所需的模式传递给该方法。它用于设置 ReadOnly 属性 .Pattern
语法应根据记录的模式化方法 here:
pt.DataLabel.Format.Fill.Patterned( msoPatternZigZag );
列出了要传递的不同选项here
我相信此 UI method is achieved with the AutoShapeType
property, not Fill
. See this post 的自动化并阅读了@SiddharthRout 赢得赏金的答案。
对于您的代码,请替换此行:
pt.DataLabel.Format.Fill.Patterned = ??
有
pt.DataLabel.Format.AutoShapeType = 105;
105 是 msoShapeRectangularCallout
。我从您对其他答案的评论中注意到,您可能没有引用 Microsoft.Office.Core
名称空间,其中 enumeration lives. The magic numbers are here.
HTH