SheetToImage displaying values as ######

We are using AsposeCells.Worksheet.SheetToImage to convert an Excel spreadsheet into an image. The spreadsheet has some cells that are in the Date *3/14/2001
format.

If the column containing those dates is auto-sized, the values that are the longest get displayed as ##### instead of their actual value in the resulting image, despite appearing correctly in Excel. Shorter values display correctly. If the column is increased in width, the resulting image is correct.

I have attached an example spreadsheet and resulting converted image.

Is there a recommended minimum width for a column relative to the data it contains? The expectation is that data which displays correctly in Excel would also have the correct appearance when converted to an image.

We are using version 6.0.1.0 of Aspose.Cells.

Hi,

You can use Worksheet.AutoFitColumns() to solve your problem.

Please use the latest version:
Aspose.Cells for .NET v7.0.1.6

Thank you for the prompt reply.

Using Worksheet.AutoFitColumns() does not resolve the issue. Because the column in question was already auto-fit in Excel prior to being processed using Aspose.Cells, Worksheet.AutoFitColumns() did not change the column’s width. The resulting image was no different from processing without Worksheet.AutoFitColumns().

Is there any assurance that the upgrade would resolve this issue? We would prefer to know definitively that it will solve the problem before we engage in the serious undertaking of updating the Aspose components in all of our products for all of our customers.

Hi,


Using the latest fixed version v7.0.1.6 (shared by Shakeel Faiz) works fine. You don’t need to autofit cols.

Sample code:

Workbook wb = new Workbook(“e:\test2\TestBook\TestBook.xlsx”);
Worksheet wsChart = wb.Worksheets[0];
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
imgOptions.ImageFormat = ImageFormat.Tiff;
imgOptions.HorizontalResolution = 300;
imgOptions.VerticalResolution = 300;

Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(wsChart, imgOptions);
System.Drawing.Bitmap img = sr.ToImage(0);
img.Save(“e:\test2\TestBook\test_” + DateTime.Now.ToString(“HHmm”) + “.tiff”, ImageFormat.Tiff);

See the output image (attached) using the above code.

Thank you.