using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Aspose.Cells;
using Aspose.Cells.Drawing;
using Aspose.Cells.Rendering;
using System.IO;
using System.Data;
public partial class Test_ExportImage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//调用
MemoryStream stream = OutFileToStream(NewTable(), "测试");
Workbook book = new Workbook(stream);
Worksheet sheet = book.Worksheets[0];
sheet.PageSetup.LeftMargin = 0;
sheet.PageSetup.RightMargin = 0;
sheet.PageSetup.BottomMargin = 0;
sheet.PageSetup.TopMargin = 0;
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
imgOptions.OnePagePerSheet = true;
imgOptions.PrintingPage = PrintingPageType.IgnoreBlank;
SheetRender sr = new SheetRender(sheet, imgOptions);
sr.ToImage(0, "C:\\book.jpg");//将excle 保存成图片
//string _fileName = DateTime.Now.ToString("yyyyMMddHHmmssff") + "." + ".xls"; //随机文件名