When performing a SheetRender.ToImage we are receiving a Stack overflow in Aspose.Cells.dll
String imageFilePath = Server.MapPath("~\\Images\\tiles\\");
String imageFile = imageFilePath + newImageName;
// Get a new bitmap image of the represented chart.
Workbook wb = new Workbook(thePath + "\\" + theWorkbook);
Worksheet ws = wb.Worksheets[theWorksheet];
PageSetup ps = ws.PageSetup;
ps.LeftMargin = 0;
ps.RightMargin = 0;
ps.TopMargin = 0;
ps.BottomMargin = 0;
ps.CenterHorizontally = true;
ps.CenterVertically = true;
ps.PrintArea = theRange;
//Define ImageOrPrintOptions
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
//Specify the image format
imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
//Only one page for the whole sheet would be rendered
// -- OBSOLETE imgOptions.IsImageFitToPage = false;
imgOptions.OnePagePerSheet = true;
//imgOptions.OnlyArea = true;
imgOptions.IsImageFitToPage = true;
imgOptions.OnlyArea = true;
//Render the sheet with respect to specified image/print options
SheetRender sr = new SheetRender(ws, imgOptions);
//Render the image for the sheet
try
{
sr.ToImage(0, imageFile); // CODE DIES HERE.
}
catch (Exception e)
{
}