Aspose.Cells 怎么把图片放入excel中 图片从虚拟路径获得的 在线等~~~~
WorkbookDesigner designer = new WorkbookDesigner();string fileToSave = Path.Combine(Server.MapPath("~/"), "Report/Image/" + name + ".xls");
if (File.Exists(fileToSave));
File.Delete(fileToSave);
designer.Save(fileToSave, FileFormatType.Excel97To2003);
designer.Open(Server.MapPath("~/Report/Image/" + name + ".xls"));
Workbook workbook = new Workbook();
workbook.Worksheets.Clear();
workbook.Worksheets.Add("New Worksheet1");
Worksheet sheet = workbook.Worksheets["New Worksheet1"];
FileStream fs = File.OpenRead(NameAll1);
int filelength = (int)fs.Length;
Byte[] image = new Byte[filelength];
fs.Read(image, 0, filelength);
MemoryStream stream = new MemoryStream(image);
sheet.Shapes.AddPicture(0, 5, 10, 10, stream);
String filename = string.Format("{0}.xls", name);
Response.ContentEncoding = Encoding.GetEncoding("UTF-7");
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
Response.End();
这是我的代码,求大神看下哪里错了?
导出的Excel不是乱码就是个空Excel
还有,明明已经对Worksheet 命名了,导出的名字永远都是不对的
跪求指点
补充:.NET技术 , C#