博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Aspose.Cell 生成带水印的excel文件
阅读量:4314 次
发布时间:2019-06-06

本文共 1565 字,大约阅读时间需要 5 分钟。

1  private void ExportDataSet(string fileName, string templatePath, DataSet ds, HttpResponse reponse, FileFormatType FileType= FileFormatType.Xlsx) 2         { 3             Aspose.Cells.License Clicense = new Aspose.Cells.License(); 4             string asposePath = Server.MapPath(ConfigurationManager.AppSettings["AsposeLicensePath"]); 5             //string asposePath = Server.MapPath(@"../Template/Aspose/Aspose.Total.lic"); 6             Clicense.SetLicense(asposePath); 7  8             WorkbookDesigner designer = new WorkbookDesigner(); 9 10             designer.Open(Server.MapPath(templatePath));11             designer.SetDataSource(ds);12 13             // 生成水印图片14             Aspose.Cells.Drawing.Shape wordart = designer.Workbook.Worksheets[0].Shapes.AddTextEffect(MsoPresetTextEffect.TextEffect1,15 "CONFIDENTIAL", "Arial Black", 60, false, true16 , 1, 8, 1, 1, 130, 500);17 18             //Get the fill format of the word art19             MsoFillFormat wordArtFormat = wordart.FillFormat;20 21             //Set the color22             wordArtFormat.ForeColor = System.Drawing.Color.Red;23 24             //Set the transparency25             wordArtFormat.Transparency = 0.9;26 27             //Make the line invisible28             MsoLineFormat lineFormat = wordart.LineFormat;29             lineFormat.IsVisible = false;30 31             designer.Process();32             //将流文件写到客户端流的形式写到客户端33             designer.Save(fileName, SaveType.OpenInExcel, FileType, reponse);34         }

 

转载于:https://www.cnblogs.com/michelledawm/p/10471731.html

你可能感兴趣的文章
c#多个程序集使用app.config 的解决办法
查看>>
Linux+Apache+PHP+MySQL服务器环境配置(CentOS篇)
查看>>
Linux下获取本机IP地址的代码
查看>>
(C#)调用Webservice,提示远程服务器返回错误(500)内部服务器错误
查看>>
flex布局
查看>>
python-----python的文件操作
查看>>
java Graphics2d消除锯齿,使字体平滑显示
查看>>
控件中添加的成员变量value和control的区别
查看>>
Spring Boot Docker 实战
查看>>
Div Vertical Menu ver3
查看>>
Git简明操作
查看>>
InnoDB为什么要使用auto_Increment
查看>>
课堂练习之买书打折最便宜
查看>>
定义函数
查看>>
网络虚拟化技术(二): TUN/TAP MACVLAN MACVTAP
查看>>
MQTT协议笔记之mqtt.io项目HTTP协议支持
查看>>
(转)jQuery中append(),prepend()与after(),before()的区别
查看>>
Tecplot: Legend和图像中 Dashed/Dash dot/Long dash 等虚线显示没有区别的问题
查看>>
win8 开发之旅(2) --连连看游戏开发 项目错误的总结
查看>>
一、 object c -基础学习第一天 如何定义一个类
查看>>