如何使用SpreadSheetlight添加到文本标签对于Excel图表 [英] How to add to Text Label For excel Charts using SpreadSheetlight

查看:127
本文介绍了如何使用SpreadSheetlight添加到文本标签对于Excel图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我需要自动化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

推荐答案

此论坛适用于.Net Framework类库的问题。有关SpreadsheetLight的问题,请尝试该公司的支持页面
spreadsheetlight.com/support/
This forum is for questions abut the .Net Framework Class Libraries. For questions about SpreadsheetLight, try that company's support page spreadsheetlight.com/support/


这篇关于如何使用SpreadSheetlight添加到文本标签对于Excel图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆