public void Export(string businessDate, string conditionREPDZABM, string conditionMonFee, string conditionNoMaster, string conditionQQJY, string conditionPresent, string conditionAgio, string exportFilePath) { System.Data.DataTable dt = GetByCondition(businessDate, conditionREPDZABM, conditionMonFee, conditionNoMaster, conditionQQJY, conditionPresent, conditionAgio ); string[,] arrayExport = Tools.DataTableToArray(dt, false); using (ExcelProcess excelProcess = new ExcelProcess(exportFilePath)) { Worksheet sheet = excelProcess.GetSheet(1); Range range = excelProcess.GetRange(sheet, 7, 1, 9, 7); range.Value2 = arrayExport; range.Value2 = range.Value2; excelProcess.SetCells(sheet, 3, 2, businessDate); excelProcess.SetCells(sheet, 15, 7, DateTime.Now.ToString("yyyyMMdd")); excelProcess.Save(); } }
public void Export(string businessDate, string conditionOffset, string conditionLowestConsumption, string conditionGroupPrepay, string conditionUser1, string conditionUser2, string exportFilePath) { DataSet ds = GetByCondition(businessDate, conditionOffset, conditionLowestConsumption, conditionGroupPrepay, conditionUser1, conditionUser2); System.Data.DataTable dt1 = ds.Tables[0]; System.Data.DataTable dt2 = ds.Tables[1]; string[,] arrayExport1 = Tools.DataTableToArray(dt1, false); string[,] arrayExport2 = Tools.DataTableToArray(dt2, false); using (ExcelProcess excelProcess = new ExcelProcess(exportFilePath)) { Worksheet sheet = excelProcess.GetSheet(1); Range range1 = excelProcess.GetRange(sheet, 8, 1, 8, 7); range1.Value2 = arrayExport1; range1.Value2 = range1.Value2; Range range2 = excelProcess.GetRange(sheet, 16, 1, 16, 3); range2.Value2 = arrayExport2; range2.Value2 = range2.Value2; excelProcess.SetCells(sheet, 3, 2, businessDate); excelProcess.SetCells(sheet, 20, 7, DateTime.Now.ToString("yyyyMMdd")); excelProcess.Save(); } }
public void Export(string businessDate, string exportFilePath) { System.Data.DataTable dt = GetByBusinessDate(businessDate); string[,] arrayExport = Tools.DataTableToArray(dt, false); using (ExcelProcess excelProcess = new ExcelProcess(exportFilePath)) { Worksheet sheet = excelProcess.GetSheet(1); Range range = excelProcess.GetRange(sheet, 2, 1, 13, 10); range.Value2 = arrayExport; range.Value2 = range.Value2; Range rangeBusinessDate = excelProcess.GetRange(sheet, 2, 1, 3, 1); rangeBusinessDate.Merge(rangeBusinessDate.MergeCells); Range rangeMoneyTotal = excelProcess.GetRange(sheet, 2, 2, 3, 2); rangeMoneyTotal.Merge(rangeMoneyTotal.MergeCells); excelProcess.SetCells(sheet, 4, 2, string.Empty); rangeBusinessDate = excelProcess.GetRange(sheet, 5, 1, 6, 1); rangeBusinessDate.Merge(rangeBusinessDate.MergeCells); rangeMoneyTotal = excelProcess.GetRange(sheet, 5, 2, 6, 2); rangeMoneyTotal.Merge(rangeMoneyTotal.MergeCells); excelProcess.SetCells(sheet, 7, 2, string.Empty); rangeBusinessDate = excelProcess.GetRange(sheet, 8, 1, 9, 1); rangeBusinessDate.Merge(rangeBusinessDate.MergeCells); rangeMoneyTotal = excelProcess.GetRange(sheet, 8, 2, 9, 2); rangeMoneyTotal.Merge(rangeMoneyTotal.MergeCells); excelProcess.SetCells(sheet, 10, 2, string.Empty); rangeBusinessDate = excelProcess.GetRange(sheet, 11, 1, 12, 1); rangeBusinessDate.Merge(rangeBusinessDate.MergeCells); rangeMoneyTotal = excelProcess.GetRange(sheet, 11, 2, 12, 2); rangeMoneyTotal.Merge(rangeMoneyTotal.MergeCells); excelProcess.SetCells(sheet, 13, 2, string.Empty); excelProcess.Save(); } }
public void Export(string businessDate, string exportFilePath) { System.Data.DataTable dt = GetByBusinessDate(businessDate); string[,] arrayExport = Tools.DataTableToArray(dt, false); using (ExcelProcess excelProcess = new ExcelProcess(exportFilePath)) { Worksheet sheet = excelProcess.GetSheet(1); Range range = excelProcess.GetRange(sheet, 9, 1, 11, 10); range.Value2 = arrayExport; range.Value2 = range.Value2; excelProcess.SetCells(sheet, 3, 2, businessDate); excelProcess.SetCells(sheet, 18, 6, DateTime.Now.ToString("yyyyMMdd")); excelProcess.Save(); } }
public void Export(string businessDate, string exportFilePath) { System.Data.DataTable dt = GetByBusinessDate(businessDate); string[,] arrayExport = Tools.DataTableToArray(dt, false); using (ExcelProcess excelProcess = new ExcelProcess(exportFilePath)) { Worksheet sheet = excelProcess.GetSheet(1); excelProcess.CopyRowInsert(sheet, 7, 8, 6 + arrayExport.GetLength(0)); Range range = excelProcess.GetRange(sheet, 7, 1, 6 + arrayExport.GetLength(0), arrayExport.GetLength(1)); range.Value2 = arrayExport; range.Value2 = range.Value2; excelProcess.SetCells(sheet, 3, 2, businessDate); excelProcess.Save(); } }
public string Export(string businessDateStart, string businessDateEnd, byte businessType, string businessTypeValue, string exportFilePath) { System.Data.DataTable dt = GetAllByBusinessType(businessDateStart, businessDateEnd, businessType, businessTypeValue); string[,] arrayExport = Tools.DataTableToArray(dt, true); if (businessDateStart == businessDateEnd) { using (ExcelProcess excelProcess = new ExcelProcess(exportFilePath)) { Worksheet sheet = excelProcess.GetSheet(1); Range range = excelProcess.GetRange(sheet, 1, 1, arrayExport.GetLength(0), arrayExport.GetLength(1)); range.Value2 = arrayExport; range.Value2 = range.Value2; excelProcess.Save(); } } else { int fixedColumnCount = 4; using (ExcelProcess excelProcess = new ExcelProcess(exportFilePath)) { Worksheet sheet = excelProcess.GetSheet(1); Range range = excelProcess.GetRange(sheet, 1, 1, arrayExport.GetLength(0), arrayExport.GetLength(1)); range.Value2 = arrayExport; range.Value2 = range.Value2; excelProcess.CopyRowInsert(sheet, 1, 2, 2); excelProcess.GetRange(sheet, 1, 1, 2, 1).Merge(); excelProcess.GetRange(sheet, 1, 2, 2, 2).Merge(); excelProcess.GetRange(sheet, 1, 3, 2, 3).Merge(); excelProcess.GetRange(sheet, 1, 4, 2, 4).Merge(); for (int colIndex = 0; colIndex < arrayExport.GetLength(1) - fixedColumnCount; colIndex++) { excelProcess.SetCells(sheet, 1, colIndex + fixedColumnCount + 1, "金额"); } excelProcess.GetRange(sheet, 1, fixedColumnCount + 1, 1, arrayExport.GetLength(1)).Merge(); excelProcess.Save(); } }//end else (businessDateStart != businessDateEnd) string businessTypeName = string.Empty; switch (businessType) { case (byte)SynthesizeAnalyBusinessType.VoiceClass: { businessTypeName = "语单类"; break; } case (byte)SynthesizeAnalyBusinessType.DreamClass: { businessTypeName = "梦网类"; break; } case (byte)SynthesizeAnalyBusinessType.DataClass: { businessTypeName = "数据类"; break; } case (byte)SynthesizeAnalyBusinessType.GroupClass: { businessTypeName = "集团类"; break; } } string saveFileName = string.Empty; if (businessDateStart != businessDateEnd) { saveFileName = string.Format("{0}-{1}无主{2}.xls", businessDateStart, businessDateEnd, businessTypeName); } else { saveFileName = string.Format("{0}无主{1}.xls", businessDateStart, businessTypeName); } return saveFileName; }