Пример #1
0
 public static CreateExcelTest GetCreateExcelTest()
 {
     if (createExcel == null)
     {
         return(createExcel = new CreateExcelTest());
     }
     return(createExcel);
 }
Пример #2
0
        private void OpenExcel()
        {
            workBook_excel = CreateExcelTest.GetCreateExcelTest().GetWorkBookExcel();
            string filepath = @"..\..\modelFile\基本数据模板.xlsx";

            workBook  = new Workbook(filepath);
            workSheet = workBook.Worksheets[0];

            if (workBook_excel.Worksheets["Sheet2"] != null)
            {
                workSheet_excel = workBook_excel.Worksheets["Sheet2"];
            }
            else
            {
                workBook_excel.Worksheets.Add("Sheet2");
                workSheet_excel = workBook_excel.Worksheets["Sheet2"];
            }

            workSheet_excel.Copy(workSheet);
        }
Пример #3
0
        private void OpenExcel()
        {
            sqlConn.Open();
            workBook_excel = CreateExcelTest.GetCreateExcelTest().GetWorkBookExcel();
            string filepath = @"..\..\modelFile\支架模板.xlsx";

            workBook  = new Workbook(filepath);
            workSheet = workBook.Worksheets[0];

            if (workBook_excel.Worksheets["Sheet4"] != null)
            {
                workSheet_excel = workBook_excel.Worksheets["Sheet4"];
            }
            else
            {
                workBook_excel.Worksheets.Add("Sheet4");
                workSheet_excel = workBook_excel.Worksheets["Sheet4"];
            }
            workSheet_excel.Copy(workSheet);
            workBook_excel.Save(excelFilePath, SaveFormat.Xlsx);
        }
Пример #4
0
        //打开报表模板
        private void OpenExcel()
        {
            string FilePath = @"..\..\modelFile\微震模板.xlsx";

            workBook  = File.Exists(FilePath) ? new Workbook(FilePath) : new Workbook();
            workSheet = workBook.Worksheets[0];

            workBook_excel = CreateExcelTest.GetCreateExcelTest().GetWorkBookExcel();

            if (workBook_excel.Worksheets["Sheet6"] != null)
            {
                workSheet_excel = workBook_excel.Worksheets["Sheet6"];
            }
            else
            {
                workBook_excel.Worksheets.Add("Sheet6");
                workSheet_excel = workBook_excel.Worksheets["Sheet6"];
            }

            workSheet_excel.Copy(workSheet);
            workBook_excel.Save(excelFilePath, SaveFormat.Xlsx);
        }
Пример #5
0
        private void OpenExcel()
        {
            //找到模板
            string FilePath = @"..\..\modelFile\钻屑法模板.xlsx";

            //存在就创建
            workBook  = new Workbook(FilePath);
            workSheet = workBook.Worksheets[0];

            workBook_excel = CreateExcelTest.GetCreateExcelTest().GetWorkBookExcel();
            if (workBook_excel.Worksheets["Sheet5"] != null)
            {
                workSheet_excel = workBook_excel.Worksheets["Sheet5"];
            }
            else
            {
                workBook_excel.Worksheets.Add("Sheet5");
                workSheet_excel = workBook_excel.Worksheets["Sheet5"];
            }

            //将模板拷贝到报表excel
            workSheet_excel.Copy(workSheet);
            //workBook_excel.Save(excelFilePath, SaveFormat.Xlsx);
        }