分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

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

发布时间:2023-09-06 02:34责任编辑:彭小芳关键词:excel
 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 ????????}

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

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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved