c#)Excel常用格式操作
2012年09月13日
⁄ 综合
⁄ 共 1256字 ⁄ 字号
小 中 大
range.NumberFormatLocal = "@";
-
- range = (Range)worksheet.get_Range("A1", "E1");
-
- range.Merge(0);
-
- worksheet.Cells[1, 1] = "Excel单元格赋值";
-
- range.Font.Size = 15;
-
- range.Font.Underline=true;
-
- range.Font.Name="黑体"; 设置字体的种类
-
- range.HorizontalAlignment=XlHAlign.xlHAlignCenter;
-
- range.ColumnWidth=15;
-
- range.Cells.Interior.Color=System.Drawing.Color.FromArgb(255,204,153).ToArgb();
-
- range.Borders.LineStyle=1;
-
- range.BorderAround(XlLineStyle.xlContinuous,XlBorderWeight.xlThick,XlColorIndex.xlColorIndexAutomatic,System.Drawing.Color.Black.ToArgb());
-
- range.Borders.get_Item(Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeTop).LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlLineStyleNone;
-
- range.EntireColumn.AutoFit();
-
- Range.HorizontalAlignment= xlCenter;
-
- Range.VerticalAlignment= xlCenter
-
- Range.WrapText=true;
-
- Range.Interior.ColorIndex=39;
-
- Range.Font.Color=clBlue;
-
- xlsApp.DisplayAlerts=false;