Charts.ToImage quality

Hi,

Thanks for your feedback.

Anyway, I have changed the topic of my above post, so that you or others could find it more easily. It is useful for those who want to know which of chart types and chart features are supported/unsupported by Aspose.Cells API.

Hi


Sorry for troubling again, but my pixelated problem is back again, and non of the suggestions in this post seems to help (See attached)

I’ve tried changing the ImageOrPrintOptions, but nothing seems to make any difference:

public override void AddChart(ChartTemplateTypes chartLayoutType, string titleText, ChartLegendLayoutTemplateTypes legendLayoutType)
{
ExecuteSectionBreaks();
DocApplyTabStops();

base.AddChart(chartLayoutType, titleText, legendLayoutType);

Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
options.ImageFormat = ImageFormat.Tiff;
options.HorizontalResolution = Convert.ToInt32(StylesRoot.ChartTemplates[chartLayoutType].Width * 1000);
options.VerticalResolution = Convert.ToInt32(StylesRoot.ChartTemplates[chartLayoutType].Height * 1000);
options.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionCCITT4;

Image chartImage = _xlsChart.ToImage(options);
AddImage(ImageLayoutTemplateTypes.RelativeToCursorForeGround, chartImage);

}

I’ve tried setting the TiffCompression, changing the resolution, setting the image format to Emf, setting the Quality property, but nothing seems to help. It’s almost as if the ToImage method does not take these properties into account.

Am I missing something?

Hi,

Please download and try the latest version:
Aspose.Cells
for .NET v7.1.2.2

it should fix your problems. Please let us know your feedback.

If the problem still occurs, then please provide us your source xls/xlsx file containing your chart. We will look into it and help you asap.

Hi,

I have exactly the same problem: ImageOrPrintOptions are completely ignored when transforming a chart into image.

I attached a quick project sample and the images created with it (using Aspose.Cells v7.1.2.2). Neither .emf or the .tif doesn’t have an acceptable resolution (96 dpi and text is blurred).

How we should use these saving options?

Thank you

Updating to the new assemblies did not resolve the issue.


I was unable to produce my pie chart in Excel, as the XML gave an error and the chart was removed from the spreadsheet. The pie chart in the attached document is therefore not produced by Aspose. However, I’m not convinced that the source of the chart would affect the ToImage functionality.

Unfortunately, I’m very busy with fixing bugs right now, and won’t be able to produce a test application for the time being. (We’re using a wrapper class for ASPOSE, which makes it rather time consuming to find all the ASPOSE calls we’re making) I’ll get to that as soon as I have a moment available.

Hi,

Thanks for your posting.

I have generated the following image using your xlsx file with the latest version:
Aspose.Cells
for .NET v7.1.2.3



Please see the code below for a reference.

I have requested the development team to look into this issue, how to improve its quality, it should look like Ms-Excel.

We have logged this issue in our database. We will look into it and once, we will get some fix or update, we will let you know asap.

This issue has been logged as CELLSNET-40511.

C#


String filePath = “F:\Shak-Data-RW\Downloads\Pie+excel.xlsx”;


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.Worksheets[0];


Chart chart = worksheet.Charts[0];


Bitmap bmp = chart.ToImage();


bmp.Save(filePath + “.out.png”, ImageFormat.Png);


Thanks.


I’ve looked at some of the previous versions of my generated charts (attached to an earlier post in this thread dated 05-04-2011, 12:01 PM ) and those looked a lot smoother. My guess is that the code that doing the smoothing of the edges was accidently removed in a later version of the ASPOSE.Cells assemblies. Hope this helps.

Regards

Hi


I trust that you’re treating this as a critical priority bug, as this is a high profile error on something that did work properly before.

We are releasing in 3 weeks and the client is pressuring us to consider other 3rd party controls to handle the charts in our documents. This is not a desirable option, as it will require major rework and complicate maintenance. However, unless this bug is fixed quickly - preferably within the week - we might have no choice but to consider alternatives.

Regards


Hi,

Thanks for your posting and feedback.

We can understand your needs.

I have logged your comment in our database against the issue id: CELLSNET-40511

Hopefully, your issue will be fixed soon.

Hi,

We are working over your issue at the moment. We will try to provide a fix in 2-3 days hopefully.

Thanks and sorry for any inconvenience caused!
Keep in touch.

Hi,


Please try the latest fix v7.1.2.4 (attached). We have fixed your issue now.

Thank you.

Thank you.

This looks much better. Thanks for resolving this issue so quickly.

The issues you have found earlier (filed as CELLSNET-40511) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi.

Our users have started complaining about an issue that I wasn’t able to reproduce myself yet. We have an automated process generating our reports, and it has started producing charts looking like this:

Distorted.png (24.7 KB)

However, when I try to generate it manually to debut the code, I get the expected result:

Correct.png (43.2 KB)

This is very old code, which we haven’t touched in over a decade, and which have been working seamlessly until recently:

            options.ImageFormat = ImageFormat.Emf;
        options.HorizontalResolution = 500;//Convert.ToInt32(StylesRoot.ChartTemplates[chartLayoutType].Width * 100);
        options.VerticalResolution = 500;//Convert.ToInt32(StylesRoot.ChartTemplates[chartLayoutType].Height * 100);
        options.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionLZW;
        Image chartImage = _xlsChart.ToImage(options);
        AddImage(ImageLayoutTemplateTypes.RelativeToCursorForeGround, chartImage);

Is there any property I can set to ensure the graph is being drawn across the entire image, and not squashed into the top left corner?

@Hannodb,

Thanks for the screenshots.

Do you use the same Aspose.Cells for .NET version to generate both charts (distorted and correct)? Are you using two different machines to produce the charts (correct and incorrect), give us your environment details (OS, .NET framework version, etc.)? Also, give us details about the display (scale) settings of both machines? It should 100% display settings to get accurate results.

Moreover, could you please share sample console application with resource files (please zip the files prior attaching) to reproduce the issue on our end.

Hi, thanks for your feedback.

I did try recreating the issue on my local machine by changing the display settings to 125% and 150%, but with no luck.

I will have to get back to you on the rest of the queries. I’m being swamped with more important issues right now, but please, if you can think of anything else I can try to recreate it, please let me know.

@Hannodb,

Please take your time to provide the needful details and sample project with resource files. Once we receive the details and samples, we will start investigating the issue on our end.

Here is what I could find out so far:

CORRECT VERSION (Local machine):
.Net Framework 4.7.1
Aspose.Cells : 8.6.2.0
Edition: Windows 10 Enterprise
Version: 22H2
OS build: 19045.2728

BROKEN VERSION (Server):
.Net Framework 4.7.1
Aspose.Cells : 8.6.2.0
Edition: Windows Server 2012 R2 Standard

Unfortunately, I’m not sure what files to send you, as I was unable to reproduce the issue on my local machine. Its only the compiled code on the server that appears to cause the issue. The issue doesn’t seem to be data related, as it happens on every graph generated on the server.

@Hannodb,
Thank you for the information provided. We will try our best to reproduce the problem and fix it. We will notify you as soon as there are updates.

@Hannodb,
Would you like to provide one sample file which caused such kind of issue on the server? Now that all the similar template files can reproduce the issue, you may provide any one or two of them so we can check it further.