Hi,
I want to change a chart outline. In Excel, it’s ‘Shape Outline’ property (Chart Tools -> Format -> Shape Styles -> Shape Outline).
I found the same property for shapes and images. A chart has a property with the same name as a shape (‘LineFormat’), but it does not change what I need. I did not find What it changes at all.
Could you help me to figure out How to change this property?
I created a simple document with samples of image, shape and chart that has a custom outline. Also I added a sample of my test code.
Workbook _xl = new Workbook(tbFileName.Text);
foreach (Worksheet ws in _xl.Worksheets)
{
System.Drawing.Color color = System.Drawing.Color.FromArgb(ceColor.Color.A, ceColor.Color.R, ceColor.Color.G, ceColor.Color.B);
double weight = (double)seWeight.Value;
foreach (Picture pic in ws.Pictures) // It works as expected
{
pic.BorderLineColor = color;
pic.BorderWeight = weight;
}
foreach (Chart chart in ws.Charts) // It does not make any visible change. How can I change ‘Shape Outline’?
{
chart.ChartObject.LineFormat.Weight = weight;
chart.ChartObject.LineFormat.ForeColor = color;
}
foreach (Aspose.Cells.Drawing.Shape shape in ws.Shapes) // It works as expected
{
shape.LineFormat.Weight = weight;
shape.LineFormat.ForeColor = color;
}
}
string str = _xl.FileName + “.ch” + io.Path.GetExtension(_xl.FileName);
if (!string.IsNullOrEmpty(_xl.FileName)) _xl.Save(str);
I use Excel 2010 and Aspose.Cells v7.4.2.0.
Many thanks,
Alex Shloma