问题描述
您好我需要自动化excel图表 所以我使用Spread sheet api生成图表请解决这个对我来说非常重要
Hello i have requriement to automate excel charts so i am using Spread sheet api for generating the charts please sol this its very important for me
如何使用SpreadSheetlight在Excel中向图表添加文本框
How to add a Text Box to Chart in Excel Using SpreadSheetlight
我要求我要为SlChart添加标签,
I have requirement i want add label to SlChart,
这是我的示例代码:
Here is my sample code :
请看这个例子
please see this examples
http://spreadsheetlight.com/downloads/samplecode/ChartSheetExample.cs
http://spreadsheetlight.com/downloads/samplecode/ChartSheetExample.cs
http://spreadsheetlight.com/sample-code/
http://spreadsheetlight.com/sample-code/
public SLChart GenerateSLClusteredcolumnChart(int NOOFROWS, string ChartName, String Title, string xAxis, string yAxis , string extralabel)
{
SLWorksheetStatistics wsstats = ExcelWorkBook.GetWorksheetStatistics();
int rows = wsstats.EndRowIndex - NOOFROWS;
int StartCellRefer = rows + 1;
int EndCellRefer = wsstats.EndRowIndex;
string Columnaddress = ColumnLetter(wsstats.EndColumnIndex - 1);
double fChartHeight = 22.0;
double fChartWidth = 15.5;
SLChart chart;
chart = ExcelWorkBook.CreateChart("AD" + StartCellRefer, Columnaddress + EndCellRefer); //dataselection
chart.SetChartStyle(SLChartStyle.Style10);
chart.SetChartType(SLColumnChartType.ClusteredColumn);
chart.SetChartPosition(StartCellRefer, 2, StartCellRefer + fChartHeight, 2 + fChartWidth);
chart.ChartName = ChartName;
chart.Legend.LegendPosition = LegendPositionValues.Right;
SLFont ft;
SLRstType rst = ExcelWorkBook.CreateRstType();
ft = ExcelWorkBook.CreateFont();
ft.SetFont(FontSchemeValues.Major, 12);
ft.SetFontThemeColor(SLThemeColorIndexValues.Accent1Color);
rst.AppendText(Title, ft);
chart.Title.SetTitle(rst);
chart.ShowChartTitle(false);
return chart;
}
Ranjith @Learner @Microsoft产品
Ranjith@Learner @Microsoft products
推荐答案
这篇关于如何使用SpreadSheetlight添加到文本标签对于Excel图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!