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

Free Support Forum - aspose.com

Distorted html charts

Hi

I have an intermittent problem in my production server. When exporting to html, graphs are distorted as you can see here:
Bad.png (8.2 KB)

But yesterday, on same server:
Good.png (12.5 KB)

It happens with all workbooks, from time to time. And it never happens on my development server, with the same code, same workbooks and same fonts installed.

The only difference between both servers, is that development is a physical machine, and production is virtualized. Could it has something to do? Can you suggest me what HtmlExportOptions should I change in order to try to solve it? My current options are:

new HtmlSaveOptions() { ExportImagesAsBase64 = true, ExportActiveWorksheetOnly = true, HiddenColDisplayType = HtmlHiddenColDisplayType.Remove, HiddenRowDisplayType = HtmlHiddenRowDisplayType.Remove, RefreshChartCache =true }))

I previously didn’t have the RefreshChartCache option, and the problem was already present. I put it because the intermittence of the problem looked to me like a cache issue, can you explain what is this “chart cache”?

Thank you

@DeliaZgz,

Thanks for the screenshots and details.

We are not entirely certain about your issue. This is strange as according to you the issue occurs periodically. May be you have changed the Aspose.Cells version on the server. We recommend you to kindly try our latest version/fix: Aspose.Cells for .NET v19.2.

Moreover, there is no specific attribute to get your issue sorted out. I am afraid, we got to reproduce the issue first on our end, then we can investigate and try to figure it out soon.

No, we haven’t changed version… it’s 18.9 from the beginning.
I’ll make some more tests before upgrading, I’ve noticed the problem usually arises or dissappears after appPool recycling on IIS.

Could you please explain the meaning of “RefreshChartCache”? Documentation is not very clarifying…

Thank you

@DeliaZgz,

The RefreshChartCache option is used to refresh the chart(s). Please note, you need to set RefreshChartCache as true if the data source of the chart or the setting of the chart is changed as Aspose.Cells does not automatically refresh the chart by default.

I’m unable to reproduce the issue when I want. I only know that when it happens, it gets solved after recycling appPool on IIS.

According to our graphic designer, it looks like a font smoothing problem. I’ve set these HtmlSaveOptions:

opt.ImageOptions.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
opt.ImageOptions.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

And I will wait some days…

Thank you

@DeliaZgz,

Good to know that your issue is sorted out by recycling appPool now. And if you again find the issue or have some other query, feel free to write us back with all the details, sample code and template files, we will check it soon.

No. Problem is temporary solved by recycling appPool, but it happens again. I think you have a problem with process model of Internet Information Server.

Maybe I have solved it by setting the smoothing mode, but I still don’t know.

@DeliaZgz,

As I asked you we need to reproduce the issue on our end, so we could accurately investigate the issue to sort it out soon. You may get back to us with complete details (also with environment details), sample application (runnable), screenshots and resource files to show the issue if you find the issue yet again.

Hi Amjad

I’m still unable to reproduce the problem when I want, but it keeps happening every 5-7 days on production server. I’ve managed to isolate the problem to these lines of code:

using (Workbook wb = new Workbook("test.xlsx"))
{
	ImageOrPrintOptions imgOpt = new ImageOrPrintOptions();
	imgOpt.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

	Bitmap img = wb.Worksheets[0].Charts[0].ToImage(imgOpt);
	img.Save("test1.png", System.Drawing.Imaging.ImageFormat.Png);
    wb.Worksheets[0].Charts[0].ToImage("test2.png", imgOpt);
    using (FileStream st = new FileStream("test3.png", FileMode.CreateNew))
    {
		wb.Worksheets[0].Charts[0].ToImage(st, imgOpt);
	}
}

RESULT: test1.png is incorrect (font is not smooth), while test2.png and test3.png are correct

When appPool of IIS is recycled, the problem is solved and the three tests work properly, until next time.
My problem is that I need to export the whole worksheet to html with base64 images (not only images), so I cannot workaroud the problem as I do in sample code.

I attach sample excel and results, but it happens with all of my workbooks: TestXlsx.zip (28.6 KB). (Please do not open images with Windows Photo Viewer as it sometimes smooth them)

Server is Intel Xeon X5650, machine virtualized with VMWare
Windows Server 2012 R2 Standard 64 bit, IIS 8.5
Website runs on its own appPool on IIS in Integrated Mode, .NET 4.0
Aspose Cells 19.3 (but it happened with previous versions)

Please tell me if you can investigate the problem with this information, or if I can workaround it in Html saving
Thank you
Delia

@DeliaZgz,

Thanks for the sample code segment and template file.

I tested using your sample code with your template file in a simple project on Windows, it works fine and I could not spot any issue. Did you find the issue in the output files in the attached zipped archive? I still think the issue may not be related to Aspose.Cells APIs. It would be also hard to reproduce it in a simple scenario. By the way, could you try using your scenario/case without using TextRenderingHint API if you find the issue or it makes any difference on your end?

Also provide your HTML output and PDF output for reference. We may log a ticket for it after getting all the details and sample files for investigations. By the way, if you try your scenario on physical OS, will you still find the issue?
files1.zip (19.7 KB)

Yes, problem also happens without using TextRenderingHint. But the day it happens, my sample code (test 2 and 3) only works by specifing TextRenderingHint.

I have been unable to reproduce the issue even with a second website on same server. It doesn’t solve with app restart, only with appPool recycling.

PDF export is always correct. I attach wrong and right html export with base64 images: Test_html.zip (22.1 KB)

I agree that it will be very hard to reproduce the problem in another scenario. Maybe it is some cross side effect of some code in our application, but as I can’t debug or even see Aspose code, I’m completely lost. If I purchase paid support, could we work together in order to test different Aspose Cells dlls on my server and debug problem?

@DeliaZgz,

Thanks for the sample files and further details.

I have logged an investigation ticket with an id “CELLSNET-46699” for your issue. We will look into it soon. The issue is logged as:
CELLSNET-46699 - Graphs are distorted when exporting to HTML

Once we have an update no it, we will let you know.

Yes, you can purchase paid support that may speed up the investigations and resolution.

@DeliaZgz,

We are pleased to inform you that your issue has been resolved on priority basis (since you have availed priority support level). Either our priority support help desk or we will soon provide you fix (after performing QA and other enhancements).

@DeliaZgz,
Please try our latest version/fix: Aspose.Cells for .NET v19.4.4:

Aspose.Cells19.4.4 For .Net2_AuthenticodeSigned.Zip (4.9 MB)
Aspose.Cells19.4.4 For .Net4.0.Zip (4.9 MB)

Your issue should be fixed in it.

Let us know your feedback.

Hi, please tell me about the nature of the fix.
I have waited until the problem arises (today), I have substituted dll, and the problem persists (until tonight appPool recycle, I guess)

Althought my concern is exporting whole html and not only images, I have tested the code I sent you on April 23th, and I can tell you:

  • With Aspose.Cells 19.3.0 test1.png is incorrect (font is not smooth), while test2.png and test3.png are correct
  • With Aspose.Cells 19.4.4 only test3.png is correct. So now Chart.ToImage(imageFile) also seems to present the problem

@DeliaZgz,

Please provide your feedback or follow up in your PS thread:
https://helpdesk.aspose.com/scp/tickets.php?id=5926

one of our colleagues from paid support helpdesk will help you soon there.