Hi
Attached to this issue is an Excel sheet with three charts.
The charts all have a shadow, and a text in the center of the circle.
When exporting the charts to images, the shadow disappears, and the text moves a bit.
This means that our end user has to “offset” the text in the Excel sheet, to have it look properly once exported to images.
The expected result would be that the charts has shadows, and the text is located as it is in Excel. So you can place the text correct in Excel.
The image is extracted with the code below, using Aspose.Cells 8.7.1.
public bool ExportGraph(string pName, string pPath)
{
bool success = false;
foreach (var worksheet in Workbook.Worksheets)
{
foreach (var chart in worksheet.Charts)
{
if (chart.Name.ToLower() != pName.ToLower())
continue;
ImageOrPrintOptions test = DetermineImageOptions(pPath);
chart.ToImage(pPath, test);
success = true;
break;
}
}
return success;
}
internal static ImageOrPrintOptions DetermineImageOptions(string imagePath)
{
var fileExtension = Path.GetExtension(imagePath).ToUpper();
Aspose.Cells.Rendering.ImageOrPrintOptions options;
switch (fileExtension)
{
case “.PNG”:
options = new ImageOrPrintOptions
{
ImageFormat = System.Drawing.Imaging.ImageFormat.Png,
SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality,
};
break;
case “.SVG”:
options = new ImageOrPrintOptions
{
SaveFormat = SaveFormat.SVG,
SVGFitToViewPort = true,
};
break;
default:
throw new ArgumentException(“Currently we only support PNG and SVG Images”);
}
return options;
}
best regards
/Anders