最近项目中一直在写XML、Table、Excel之间的转化
之前一直都是不考虑格式的导出,今天给出一个格式,让按照格式导出,还真把我这新手为难了一翻,网上给出的资料基本一样
为了一个单元格文字变色纠结了很久
下面把学习资料发出,希望对新手学习有所帮助: 下面是会用到的导出属性
合并单元格属性: worksheet
get_Range(worksheet
Cells[rowIndex, columnCount + 1], worksheet
Cells[rowIndex + 2, columnCount + 1])
MergeCells = true; 设置某一个单元格中字体的颜色: worksheet
get_Range(worksheet
Cells[rowIndex, 5], worksheet
Cells[rowIndex, 8])
ColorIndex = 5;(这个在网上找的一直变不了色,后面自己试出来了) 字体颜色的 index值: 选定区间设置字符串格式或数字格式: Microsoft
Office
Interop
Range range = worksheet
get_Range(worksheet
Cells[rowIndex, 1], worksheet
Cells[rowCount+rowIndex-1, columnCount-1]); range
NumberFormat = "@";//设置数字文本格式 Microsoft
Office
Interop
Range rangeinfo = worksheet
get_Range(worksheet
Cells[rowIndex, 4], worksheet
Cells[rowCount + rowIndex - 1, 4]); rangeinfo
NumberF