日期:2011-07-26  浏览次数:20550 次

private void btnPrintData_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);
          
            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;
            xlsSheet.Cells[2, intCols + 1] = "制";
            xlsSheet.Cells[3, intCols + 1] = "表";
            xlsSheet.Cells[4, intCols + 1] = ":";
            xlsSheet.Cells[7, intCols + 1] = "一";
            xlsSheet.Cells[8, intCols + 1] = "校";
            xlsSheet.Cells[9, intCols + 1] = ":";
            xlsSheet.Cells[12, intCols + 1] = "二";
            xlsSheet.Cells[13, intCols + 1] = "校";
            xlsSheet.Cells[14, intCols + 1] = ":";
            xlsSheet.Cells[17, intCols + 1] = "验";
            xlsSheet.Cells[18, intCols + 1] = "收";
            xlsSheet.Cells[19, intCols + 1] = ":";
            xlsSheet.Cells[1, 3] = "施测日期:" + dtpS3.Text;
            xlsSheet.Cells[1, 7] = "测探工具:" + txtCtgongju.Text;
            xlsSheet.Cells[1, 10] = "水位:" + txtS4.Text + "m";
            // xlsSheet.Cells[1, intCols] = "制表:";


            for (int j = 0; j < intCols; j++)
       &