<div class=”text-center”><img alt=”Spire.Doc” class=”img-thumbnail” src=”http://image.evget.com/images/article/2018/L-20181009-PPT-1.png” style=”border:0″ /></div>
//创建Presentation实例Presentation ppt = new Presentation();//加载PowerPoint文档ppt.LoadFromFile("Input.pptx");//获取图表IChart chart = ppt.Slides[0].Shapes[0] as IChart;//给图表的第一个系列添加数据标签,并设置数据标签的格式//给第一个数据点添加数据标签ChartDataLabel label1 = chart.Series[0].DataLabels.Add();//显示标签的值label1.LabelValueVisible = true;//显示标签的系列名称label1.SeriesNameVisible = true;//设置标签的边框样式label1.Line.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;label1.Line.SolidFillColor.Color = Color.Red;//设置标签的填充样式label1.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;label1.Fill.SolidColor.Color = Color.Yellow;//给第二个数据点添加数据标签ChartDataLabel label2 = chart.Series[0].DataLabels.Add();//显示标签的值label2.LabelValueVisible = true;//显示标签的系列名称label2.SeriesNameVisible = true;//设置标签的边框样式label2.Line.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;label2.Line.SolidFillColor.Color = Color.Red;//设置标签的填充样式label2.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;label2.Fill.SolidColor.Color = Color.Yellow;//给第三个数据点添加数据标签ChartDataLabel label3 = chart.Series[0].DataLabels.Add();//显示标签的值label3.LabelValueVisible = true;//显示标签的系列名称label3.SeriesNameVisible = true;//设置标签的边框样式label3.Line.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;label3.Line.SolidFillColor.Color = Color.Red;//设置标签的填充样式label3.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;label3.Fill.SolidColor.Color = Color.Yellow;//给第四个数据点添加数据标签ChartDataLabel label4 = chart.Series[0].DataLabels.Add();//显示标签的值label4.LabelValueVisible = true;//显示标签的系列名称label4.SeriesNameVisible = true;//设置标签的边框样式label4.Line.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;label4.Line.SolidFillColor.Color = Color.Red;//设置标签的填充样式label4.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;label4.Fill.SolidColor.Color = Color.Yellow;//保存文档ppt.SaveToFile("DataLabels.pptx", FileFormat.Pptx2013);
<P>效果图:</P>
<div class=”text-center”><img alt=”Spire.Doc” class=”img-thumbnail” src=”http://image.evget.com/images/article/2018/L-20181009-PPT-2.png” style=”border:0″ /></div>
标签:图表图表解决方案
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!