((Worksheet) excel.ActiveSheet). Columns("A:A").ColumnWidth = 6.5;提示
“Excel._Worksheet.Columns”表示“属性”,此处应为“方法”

解决方案 »

  1.   

    1, Columns("A:A").ColumnWidth = 200;
    2,一般是可以,只要不用2003特有的功能
      

  2.   

    参见http://www.c-sharpcorner.com/Code/2004/March/ExcelReportsInNet.asp
      

  3.   

    excel.Application appl = new excel.Application(); 
    appl.Visible = true;
    excel.Workbook wb = appl.Workbooks.Add(excel.XlWBATemplate.xlWBATWorksheet);
    appl.StandardFont = "Arial";
    appl.StandardFontSize = 8;
    excel.Worksheet sheet = (excel.Worksheet)wb.Worksheets[1]; 
    sheet.Rows.RowHeight = 20;
    excel.Range r = (excel.Range)sheet.Cells[10,1];
    r.RowHeight = 30;
    r.ColumnWidth = 50;
    r.Font.Bold = true;
    r.Font.Size = 10;
    r.Value = "cell 10,1";
    r.Font.Color = 234234234;
    r.Interior.Color = 1343465;
    r.VerticalAlignment = excel.XlVAlign.xlVAlignBottom;
    r.HorizontalAlignment = excel.XlHAlign.xlHAlignRight;
    r = (excel.Range)sheet.Cells[12,1];
    r.Interior.PatternColor = 128128128;
    r.Interior.Pattern = excel.XlPattern.xlPatternHorizontal;
      

  4.   

    using Microsoft.Office.Interop.Excel; ApplicationClass NewExcelApplication = 
    new ApplicationClass(); 
    NewExcelApplication.DisplayAlerts = false; 
    Workbook book = 
    NewExcelApplication.Workbooks.Open(@"C:\Book1.xls", 
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
    Type.Missing, Type.Missing); 
    Worksheet sheet1 = 
    (Worksheet)book.Worksheets.get_Item(1); 
    ((Range)sheet1.Columns["C", Type.Missing]).ColumnWidth = 30; 
    book.Save(); 
    NewExcelApplication.Quit();