SheetRender.ToImage() hangs without an exception or an error


We are using 'Aspose.Cells.dll' ( to convert Excel files to Tiff images and we noticed a hang when 'SheetRender.ToImage()' is being done on attached image.

Here is the sample code we are using:

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using Aspose.Cells;
using Aspose.Cells.Rendering;

namespace Test
class Program
static void Main(string[] args)
string fullPath = @"C:\Test\Input.xls";

License lic = new License();

Workbook book = new Workbook(fullPath);

ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
imgOptions.ImageFormat = ImageFormat.Tiff;
imgOptions.HorizontalResolution = 200;
imgOptions.VerticalResolution = 200;
imgOptions.TiffCompression = TiffCompression.CompressionCCITT4;
imgOptions.PrintingPage = PrintingPageType.IgnoreBlank;

for (int i = 0; i < book.Worksheets.Count; i++)
Worksheet sheet = book.Worksheets[i];

foreach (Cell cell in sheet.Cells)
Style s = cell.GetStyle();
s.Font.Color = Color.Empty;
s.ForegroundColor = Color.Empty;
s.BackgroundColor = Color.Empty;
s.Pattern = BackgroundType.None;

SheetRender sr = new SheetRender(sheet, imgOptions);

for (int j = 0; j < sr.PageCount; j++)
sr.ToImage(j, @"C:\Test\Output" + (i + 1).ToString().PadLeft(3, '0') + (j + 1).ToString().PadLeft(3, '0') + ".tif"); // Hangs Here!
catch (Exception ex)

Please review them and let us know when fix can be available.

This is critical customer request in which we need to provide fix ASAP.



Thanks for reporting this bug.

I was able to reproduce the bug with the latest version Aspose.Cells
for .NET v5.3.3.5
. Although in my case, it throws exception. Parameter is not valid.

This issue has been logged as CELLSNET-28405.


Can you provide us with ETA for fix?

We need to tell our customer when they can expect a fix for this.

Thank You!


I have attached your comments to the Ticket associated with this thread. As soon as we receive any news, we will update you here.

Thank you


We are working on “Hang” problem and we will provide a fix very soon. ETA for the fix has not been defined yet. As soon as we receive any news we will post that here.

Further investigation on your issue revealed that you have set the “Page Setup” to “Fit Sheet on One Page” in your input.xls file [see snapshot attached]. That makes your print preview very small in size and un-readable. Also, it gives the error “Parameter is Invalid”. But when we set it to “No Scaling”, we were able to produce images with out an error.

Just for workaround, we suggest you to set a reasonable print area in your source code like statement below,

workbook.Worksheets[0].PageSetup.PrintArea = “A1:L77”;


We have fixed this issue. Please download Aspose.Cells for .NET v5.3.3.6.

Thanks for a fix BUT the result is not what we expected.

When we print this excel file as is without change to print settings we get 3 pages.

BUT when we convert it to image we only get 1 page.

Doesn't matter how it looks but we want printed output & converted image be the same.

Please review.

Thanks again for quick response!!!


Thanks for your input.

We have logged your comment and fix this issue asap.


Can you give us an update on ETA for this fix?

Our customer is waiting.

Thank You.


It is inform you that we had already requested an ETA for it. Once we will get any update, we will let you know.


We have fixed this issue in Aspose.Cells for .NET v6.0.0.2. Please test your requirement with this latest assembly and let us know of your feedback.

This Works!!!

Thank You.

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

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