标签:表格 ott rand data exce add false sum 自己
1 //表格的范围需要自己定义 2 var epplus = new ExcelPackage(); 3 var sheet = epplus.Workbook.Worksheets.Add("Sheet1"); 4 var dataRange = sheet.Cells[1, 37, row, 39]; 5 var wsPivot = epplus.Workbook.Worksheets.Add("数据透视表"); 6 var pt = wsPivot.PivotTables.Add(wsPivot.Cells["A1"], dataRange, "Name"); 7 pt.Compact = true; 8 pt.CompactData = true; 9 pt.GrandTotalCaption = "Total amount";
10 pt.Fields[2].Sort = eSortType.Ascending; 11 pt.RowFields.Add(pt.Fields[2]); 12 pt.DataFields.Add(pt.Fields[0]); 13 pt.DataFields.Add(pt.Fields[1]); 14 pt.DataFields[0].Function = DataFieldFunctions.Sum; 15 pt.DataFields[1].Function = DataFieldFunctions.Sum; 16 pt.DataOnRows = false;
标签:表格 ott rand data exce add false sum 自己
原文地址:http://www.cnblogs.com/xiaomen/p/6897985.html