michelledawm
 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         }

 

分类:

技术点:

相关文章:

  • 2021-12-15
  • 2022-02-04
  • 2021-08-18
  • 2021-12-20
  • 2021-12-19
  • 2021-10-17
  • 2021-05-14
猜你喜欢
  • 2021-08-16
  • 2022-12-23
  • 2021-07-24
  • 2021-12-24
  • 2021-11-19
  • 2022-12-23
相关资源
相似解决方案