码迷,mamicode.com
首页 > Web开发 > 详细

Aspose.Cell 生成带水印的excel文件

时间:2019-03-04 17:14:44      阅读:1452      评论:0      收藏:0      [点我收藏+]

标签:black   水印图片   ons   vat   eset   conf   ase   sheet   style   

 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, true
16 , 1, 8, 1, 1, 130, 500);
17 
18             //Get the fill format of the word art
19             MsoFillFormat wordArtFormat = wordart.FillFormat;
20 
21             //Set the color
22             wordArtFormat.ForeColor = System.Drawing.Color.Red;
23 
24             //Set the transparency
25             wordArtFormat.Transparency = 0.9;
26 
27             //Make the line invisible
28             MsoLineFormat lineFormat = wordart.LineFormat;
29             lineFormat.IsVisible = false;
30 
31             designer.Process();
32             //将流文件写到客户端流的形式写到客户端
33             designer.Save(fileName, SaveType.OpenInExcel, FileType, reponse);
34         }

 

Aspose.Cell 生成带水印的excel文件

标签:black   水印图片   ons   vat   eset   conf   ase   sheet   style   

原文地址:https://www.cnblogs.com/michelledawm/p/10471731.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!