We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

No shadow- and text moving when extracting charts to svg

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

Hi,

Thanks for your posting and using Aspose.Cells.

We are afraid, we do not support shadow and glow effect for converting chart or shape to image. Could you please highlight the text moving issues in your output charts?

Please also download and try the latest version Aspose.Cells for .NET 8.7.2 to see if it makes any difference.

Ok - sad about the shadows, but noted and I will forward that message to the end user.


I have attached a new Excel sheet and image.

In the Excel sheet, the text in circles are approx in the center - but in the exported images it is not.

BR
/Anders

Hi Anders,


Thank you for sharing a new sample.

Please try the case against the latest version of Aspose.Cells for .NET 8.7.2 as it produces the correct results (attached in an archive).

C#

var workbook = new Workbook(dir + “excel_Textmoving.xlsx”);
foreach (Worksheet worksheet in workbook.Worksheets)
{
foreach (Aspose.Cells.Charts.Chart chart in worksheet.Charts)
{
string pPath = dir + chart.Name + “.png”;
ImageOrPrintOptions test = DetermineImageOptions(pPath);
chart.ToImage(pPath, test);
pPath = dir + chart.Name + “.svg”;
test = DetermineImageOptions(pPath);
chart.ToImage(pPath, test);
}
}

Hi Babar


Sorry for not trying to reproduce with that first.

It seems you are right, have just tested in our application as well.

Thanks for the quick replies and great support.

/Anders

Hi Anders,


No problem at all. It is good to know that you are up & running again. Please feel free to contact us back in case you need our further assistance with Aspose APIs.

Hi again


I was asked if there are any plans for supporting shadows on the images?

Or is it too tricky to get right?

BR
/Anders

Hi Anders,


Let me check with the product team and get back with updates in this regard.

Hi Anders,


Thank you for your patience.

Please note, I have logged a feature request in reference of rendering shape/chart shadows while converting them to the image formats. This way, we will be able to properly analyze the feature for feasibility and provide estimated schedule for the implementation. Please note the ticket has been logged as CELLSNET-44346, and we will keep you posted with updates in this regard.

Hi again,


This is to update you on the ticket logged earlier as CELLSNET-44346. Please note, the requested feature (rendering of shape shadows) is too complex to be implemented in short period of time. However, we will keep the aforementioned ticket open and will inform you as soon as we have completed the significant work towards implementing the said feature.