问题如上

解决方案 »

  1.   

    object opt = System.Reflection.Missing.Value;
    //首先假定你已经引用了excel自动化库,启动了一个excel进程 变量名为_application;
    //using Excel = Microsoft.Office.Interop.Excel;
    //.....
    Excel.Worksheet ws = ( Excel.Worksheet)_application.Workbooks[1].Worksheets[1];
    //以下是设定单元格左边框
    Excel.Range range = ( Excel.Range )ws.Cells[ 1, 9 ];
    range.Borders[Excel.XlBordersIndex.xlEdgeLeft].LineStyle = Excel.XlLineStyle.xlContinuous;
    range.Borders[Excel.XlBordersIndex.xlEdgeLeft].Weight = Excel.XlBorderWeight.xlThin;
    range.Borders[Excel.XlBordersIndex.xlEdgeLeft].ColorIndex = Excel.XlColorIndex.xlColorIndexAutomatic;
    //设定宽度
    Excel.Range rc = (Excel.Range)ws.Columns["A","A"];
    rc.ColumnWidth = 11.25;
      

  2.   


    Excel.Range rc = (Excel.Range)ws.Columns["A","A"];
    rc.ColumnWidth = 11.25;
    ===============================================
    宽度方式没测试过,想当然写的,有可能要改
    Excel.Range rc = (Excel.Range)ws.Columns[1,1];试试
      

  3.   

    每次我不知道怎么办时,就在Excel里录制宏参考宏的代码
      

  4.   

    先去问问你的客户服务器是否可以装excel再说吧。
    我用这种方式作好后,它们来了句不能装excel,我ri死他们
    rangeTemp = mySheet.get_Range( mySheet.Cells[intRowCur,intColDate], mySheet.Cells[intRowCur+1,intColDate+intColDateCnt] );
    rangeTemp.Borders[XlBordersIndex.xlEdgeBottom].LineStyle = XlLineStyle.xlContinuous;
    rangeTemp.Borders[XlBordersIndex.xlEdgeBottom].Weight = XlBorderWeight.xlThin;
    rangeTemp.Borders[XlBordersIndex.xlEdgeBottom].ColorIndex = XlColorIndex.xlColorIndexAutomatic;实际上用excel录制宏是很方便的,做excel你应该学会这点