zoukankan      html  css  js  c++  java
  • Aspose.Cell 生成带水印的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, 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         }
  • 相关阅读:
    CodeForces
    CodeForces
    Simple Robot Gym
    Gym
    Java课程03总结
    Java课程03总结
    判断字符串是否回文
    Java课程02总结
    有关二进制原码、反码、补码
    Java课程01总结
  • 原文地址:https://www.cnblogs.com/michelledawm/p/10471731.html
Copyright © 2011-2022 走看看