Hi,
I use the Aspose.Cells component,when I use the method SheetToImage like that:
Bitmap bitmap =workbook.Worksheets[0].SheetToImage(false, options);
It throws exception when the worksheet’s content is very big. How can I modify it?
(when the worksheet’s content is not very big,It can be converted to image correct. when it’s very big,It WILL THROW EXCEPTIONS)
Code:
public void ShowMapInBrowser(int curOrgID, int selYear, int type)
{
HttpResponse response = HttpContext.Current.Response;
this.MapType = type;
this.IsExport = false;
Workbook workbook = new Workbook();
switch (type)
{
case 1:
workbook = this.GetEquityMapWorkBook(curOrgID, selYear);
break;
case 2:
workbook = this.GetManagementOrgMapWorkBook(curOrgID, selYear);
break;
default:
break;
}
this.IsExport = false;
workbook.Worksheets[0].PageSetup.FitToPagesTall =5;
workbook.Worksheets[0].PageSetup.FitToPagesWide = 5;
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
options.VerticalResolution = 240;
options.HorizontalResolution = 240;
options.TiffCompression = TiffCompression.CompressionNone;
// options.PrintingPage = PrintingPageType.Default;
options.IsCellAutoFit = false;
options.PrintingPage = PrintingPageType.IgnoreBlank;
options.Quality = 1;
Bitmap bitmap = workbook.Worksheets[0].SheetToImage(false, options);//Throw exception here.
MemoryStream stream = new MemoryStream();
bitmap.Save(stream, ImageFormat.Png);
response.BinaryWrite(stream.ToArray());
response.End();
bitmap.Dispose();
}
Aspose.Cells for .NET v4.8.1.0, .NET Framework 4.0
Thanks
This message was posted using Email2Forum by babar.raza.