操作EXCEL
- 大部分操作例子http://topic.csdn.net/u/20080321/16/035d61e5-9f7a-44b1-86c7-748a6bd5b022.html
- 合并单元格:http://topic.csdn.net/t/20020828/15/977346.html
WorkSheet.Range[WorkSheet.Cells[xOrigin, yOrigin],
WorkSheet.Cells[xEnd, yEnd]].Merge;
- 画线:
worksheet.Range[ 'b7','d9' ].Borders[i].Weight :=2;
i:7,8,9,10画边框
设置不同风格的边框
http://topic.csdn.net/t/20041019/13/3469866.html
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
- 设置颜色
clapp.activesheet.cells[row,i].Interior.Color:= $dddddddd;
还有相应的
eclapp.activesheet.cells[row,i].font.color :=clgreen;
eclapp.activesheet.cells[row,i].Interior.Pattern:= 1;
eclapp.activesheet.cells[row,i].Interior.Color:= $dddddddd;
eclapp.activesheet.cells[row,i].borders[7].linestyle:=1;
eclapp.activesheet.cells[row,i].borders[7].weight:=2;
eclapp.activesheet.cells[row,i].borders[8].linestyle:=1;
eclapp.activesheet.cells[row,i].borders[8].weight:=2;
eclapp.activesheet.cells[row,i].borders[9].linestyle:=1;
eclapp.activesheet.cells[row,i].borders[9].weight:=2;
eclapp.activesheet.cells[row,i].borders[10].linestyle:=1;
eclapp.activesheet.cells[row,i].borders[10].weight:=2;
eclapp.activesheet.cells[row,i].HorizontalAlignment:=3;
eclapp.activesheet.cells[row,i].VerticalAlignment:=2;
EclApp.ActiveSheet.Columns[1].ColumnWidth := 10;