Free Support Forum -

SheetRender.ToImage() throws "Format specifier was invalid." exception


We are using 'Aspose.Cells.dll' ( to convert Excel files to Tiff images and we noticed "Format specifier was invalid." exception when 'SheetRender.ToImage()' is being done on attached files.

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"); // Exception 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 posting your issue and the sample input files.

I am able to reproduce this issue with the latest version. We have logged this issue in our database. We will get you back asap.

This issue has been logged as CELLSNET-28780.


We have fixed this issue.

Please download: Aspose.Cell for .NET v6.0.0.3

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

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