Excel 操作进阶
来源:互联网 发布:软件测试缺陷 编辑:程序博客网 时间:2024/06/05 09:19
//设置单元格样式: wSheet.get_Range(wSheet.Cells[5, i + 3], wSheet.Cells[6, i + 3]).Interior.Color = System.Drawing.ColorTranslator.ToOle(Color.Yellow); //设置底色 wSheet.get_Range(wSheet.Cells[5, i + 3], wSheet.Cells[6, i + 3]).Interior.Pattern = Excel.XlPattern.xlPatternLightUp; //设置斜线样式 //打开Excel模板 Excel.Application excel = new Excel.Application(); excel.Workbooks.Add(System.Windows.Forms.Application.StartupPath + @"\Report\Template.xls"); //不使用现有的模板:excel.Workbooks.Add(true);//向Excel插入一列 excel.get_Range("J:J", "J:J").Insert(Excel.XlInsertShiftDirection.xlShiftToRight, Excel.XlInsertFormatOrigin.xlFormatFromLeftOrAbove);//使用公式 excel.get_Range(excel.Cells[rowIndex, columnIndex], excel.Cells[rowIndex, columnIndex]).FormulaR1C1 = "=RC[-2]*2";//设置边框线 Excel.Borders borders = excel.get_Range(excel.Cells[rowIndex, columnIndex], excel.Cells[rowIndex, columnIndex]).Borders; borders[Excel.XlBordersIndex.xlEdgeBottom].Weight = Excel.XlBorderWeight.xlThin; borders[Excel.XlBordersIndex.xlEdgeLeft].Weight = Excel.XlBorderWeight.xlThin; borders[Excel.XlBordersIndex.xlEdgeRight].Weight = Excel.XlBorderWeight.xlThin; borders[Excel.XlBordersIndex.xlEdgeTop].Weight = Excel.XlBorderWeight.xlThin; borders[Excel.XlBordersIndex.xlInsideHorizontal].Weight = Excel.XlBorderWeight.xlThin; borders[Excel.XlBordersIndex.xlInsideVertical].Weight = Excel.XlBorderWeight.xlThin;//合并单元格 Excel.Range rangeTotal = excel.get_Range(excel.Cells[rowIndex, columnIndex], excel.Cells[rowIndex, columnIndex+1]); rangeTotal.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; rangeTotal.MergeCells = true; excel.Cells[rowIndex, 1] = "合計:";
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/BachelorLrz/archive/2008/02/28/2128333.aspx
- Excel 操作进阶
- POI:javaAPI操作Excel进阶(操作样式)
- java web进阶篇(十)操作Excel文件
- Java Excel 操作excel
- excel 操作
- 操作EXCEL
- 操作EXCEL
- EXCEL操作
- 操作excel
- excel操作
- Excel操作
- Excel操作
- excel操作
- Excel操作
- 操作EXCEL
- 操作excel
- excel操作
- Excel操作
- permute 指令
- VS2010 的 MSDN 帮助安装
- aspx 上传Excel出现错误:80000401a 的解决办法
- tiff库使用2 常用函数介绍
- User-Agent是什么意思?【摘】
- Excel 操作进阶
- Ant 的常用方法例子
- iframe的简单使用
- 针对该架构进行的规范XML验证失败。以下XML文档行中存在错误:|
- 11.2.0.1 Grid Infrastructure Installation Failed at Second Nodes While Running root.sh
- C# EXCEL 分组 Range.Rows.Group()
- PHP学习之memcache集群相关
- iOS: NSUserDefaults issues
- 将136.23.12.64/26划分成四个相同的子网,每个子网内有多少可用IP?