导出到Excel电子表格的vb.net数据标签 [英] vb.net data labels on export to excel spreadsheet
问题描述
我有创建excel电子表格的vb.net代码,用数据填充一些单元格,然后根据数据创建折线图。 我现在想要将标签添加到从一系列单元格中读取的数据系列之一。 我发现了这个:
chartPage.SeriesCollection(x).ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowLabel,True,True,True,True,True,True,真,真,真)
除了允许从我可以指定的范围中选择数据标签值之外,似乎每个选项都有。 这可能吗?
b
$
我可以发布代码,如果有帮助的话b
$
谢谢
Garry
I have vb.net code that creates an excel spreadsheet, populates some cells with data and then creates a line chart from the data. I would now like to add labels to one of the data series which reads from a range of cells. I have found this:
chartPage.SeriesCollection(x).ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowLabel, True, True, True, True, True, True, True, True, True)
Which seems to do every option except allow selecting the data label values from a range that I can specify. Is this possible?
I can post code if it would help
Thanks
Garry
推荐答案
嗨加里,
>>这似乎做了每一个选项除了允许从我可以指定的范围中选择数据标签值。 这可能吗?<<
>>Which seems to do every option except allow selecting the data label values from a range that I can specify. Is this possible?<<
是的,这是可能的。我们可以通过格式化数据标签来设置人工选项,如下图所示:
Yes, it is possible. We can set the labor options via format the data label like figure below:
这里有一个演示代码供您参考:
And here is a demo code for your reference:
ActiveChart.SeriesCollection(1).DataLabels.Format.TextFrame2.TextRange. _
InsertChartField msoChartFieldRange, "=Sheet1!
F
2:
这篇关于导出到Excel电子表格的vb.net数据标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!