日期:2011-07-25  浏览次数:20542 次

private void btnSaveAsData_Click(object sender, EventArgs e)
        {
            Excel.Application xlsApp = new Excel.Application();
            Excel._Workbook xlsBook = xlsApp.Workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
            Excel._Worksheet xlsSheet = (Excel._Worksheet)xlsBook.Worksheets[1];
            xlsSheet.Activate();

            xlsApp.Caption = lblDMMC.Text + "断面实测成果表 - 另存为 ";

            DataTable myDT1, myDT2;

            myDT1 = datatable(a,a1);
            myDT2 = datatable(a,a1);
           double minGaocheng = 0;//Get_min(a1);

            string[] strColName = new string[] { "起点距m", "河底高程m", "起点距m", "河底高程m", "起点距m", "河底高程m", "起点距m", "河底高程m", "起点距m", "河底高程m", "起点距m", "河底高程m", "" };
            int intCols = strColName.Length - 1;
            int intRows = myDT1.Rows.Count;

            int[] intRows1 = new int[myDT1.Rows.Count];
            int[] intcols1 = new int[myDT1.Columns.Count];

            int minrow = 0;
            int mincol = 0;
            int zhanyonghang = 3;
            xlsSheet.Cells[2, 7] = lblDMMC.Text + "断面实测成果表";
            xlsSheet.Cells[zhanyonghang+2, intCols + 1] = "制";
            xlsSheet.Cells[zhanyonghang + 3, intCols + 1] = "表";
            xlsSheet.Cells[zhanyonghang + 4, intCols + 1] = ":";
            xlsSheet.Cells[zhanyonghang + 7, intCols + 1] = "一";
            xlsSheet.Cells[zhanyonghang + 8, intCols + 1] = "校";
            xlsSheet.Cells[zhanyonghang + 9, intCols + 1] = ":";
            xlsSheet.Cells[zhanyonghang + 12, intCols + 1] = "二";
            xlsSheet.Cells[zhanyonghang + 13, intCols + 1] = "校";
            xlsSheet.Cells[zhanyonghang + 14, intCols + 1] = ":";
            xlsSheet.Cells[zhanyonghang + 17, intCols + 1] = "验";
            xlsSheet.Cells[zhanyonghang + 18, intCols + 1] = "收";
            xlsSheet.Cells[zhanyonghang + 19, intCols + 1] = ":";
            xlsSheet.Cells[zhanyonghang + 1, 3] = "施测日期:" + dtpS3.Text;
            xlsSheet.Cells[zhanyonghang + 1, 7] = "测探工具:测探杆 ";