您好,
我使用官網上的範例,將 Legend 其中一個內容改成 中文時,圖例在折行後,會有被遮到的狀況,Code 如下,
var workbook = new Workbook();
var worksheet = workbook.Worksheets[0];
worksheet.Cells["A2"].PutValue("Category1");
worksheet.Cells["A3"].PutValue("Category2");
worksheet.Cells["A4"].PutValue("Category3");
worksheet.Cells["B1"].PutValue("Column 1");
worksheet.Cells["B2"].PutValue(4);
worksheet.Cells["B3"].PutValue(20);
worksheet.Cells["B4"].PutValue(50);
worksheet.Cells["C1"].PutValue("已載入符號");
worksheet.Cells["C2"].PutValue(50);
worksheet.Cells["C3"].PutValue(100);
int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Column, 5, 0, 15, 5);
var chart = worksheet.Charts[chartIndex];
chart.SetChartDataRange("A1:C4", true);
chart.ToImage("chart1.png", ImageFormat.Png);
輸出圖檔如下,
chart1.png (913 Bytes)
C1 程式如果改成
worksheet.Cells[“C1”].PutValue(“已載入符號 11 已載入符號 22”);
輸出結果如下,
chart2.png (2.0 KB)