ChartSheetBase.ApplyDataLabels Method
Applies data labels to a point, a series, or all the series in a Microsoft.Office.Tools.Excel.ChartSheetBase.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Syntax
'Declaration
Public Sub ApplyDataLabels ( _
type As XlDataLabelsType, _
legendKey As Object, _
autoText As Object, _
hasLeaderLines As Object, _
showSeriesName As Object, _
showCategoryName As Object, _
showValue As Object, _
showPercentage As Object, _
showBubbleSize As Object, _
separator As Object _
)
public void ApplyDataLabels(
XlDataLabelsType type,
Object legendKey,
Object autoText,
Object hasLeaderLines,
Object showSeriesName,
Object showCategoryName,
Object showValue,
Object showPercentage,
Object showBubbleSize,
Object separator
)
Parameters
type
Type: Microsoft.Office.Interop.Excel.XlDataLabelsTypeThe type of data label to apply.
legendKey
Type: System.Objecttrue to show the legend key next to the point. The default value is false.
autoText
Type: System.Objecttrue if the object automatically generates appropriate text based on content.
hasLeaderLines
Type: System.ObjectFor the Microsoft.Office.Interop.Excel.Chart and Series objects, true if the series has leader lines.
showSeriesName
Type: System.ObjectThe series name for the data label.
showCategoryName
Type: System.ObjectThe category name for the data label.
showValue
Type: System.ObjectThe value for the data label.
showPercentage
Type: System.ObjectThe percentage for the data label.
showBubbleSize
Type: System.ObjectThe bubble size for the data label.
separator
Type: System.ObjectThe separator for the data label.
Remarks
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.
Examples
The following code example uses the ApplyDataLabels method to show the data values in the current Microsoft.Office.Tools.Excel.ChartSheetBase.
Private Sub ShowDataLabels()
Globals.Sheet1.Range("A1", "A5").Value2 = 22
Globals.Sheet1.Range("B1", "B5").Value2 = 55
Me.SetSourceData(Globals.Sheet1.Range("A1", "B5"), _
Excel.XlRowCol.xlColumns)
Me.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowValue, _
AutoText:=True, HasLeaderLines:=False, ShowSeriesName:=False, _
ShowCategoryName:=True, ShowValue:=True, ShowPercentage:=False, _
ShowBubbleSize:=True)
End Sub
private void ShowDataLabels()
{
Globals.Sheet1.Range["A1", "A5"].Value2 = 22;
Globals.Sheet1.Range["B1", "B5"].Value2 = 55;
this.SetSourceData(Globals.Sheet1.Range["A1", "B5"],
Excel.XlRowCol.xlColumns);
this.ApplyDataLabels(
Excel.XlDataLabelsType.xlDataLabelsShowValue,
true, false, false, true, true, false,
true);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.