在将数据库中数据输出到EXCEL中遇到的小问题,寻求指点!(30分)

  • 主题发起人 无名爱好者
  • 开始时间

无名爱好者

Unregistered / Unconfirmed
GUEST, unregistred user!
[?]在将数据库中数据输出到EXCEL中时,如何编程控制在输出的EXCEL表中画格线。
 
看看我的控件能不能帮你
http://www.51bcb.com
 
這個問題我可以幫你,不過要給分的喲!
你可以用linestyle試試
 
Delphi6+ExcelXP:
//打印边框,内边框比较淡,不过我觉得这样挺好看,
ExcelWorksheet1.PageSetup.PrintGridLines := True;
//如果需要还可以自己设置边框
//这是给A列加左边框,
var col: Variant
col:=ExcelWorksheet1.Columns;
col.Columns[‘A’].Borders[1].LineStyle:= xlContinuous;
//另外,Borders的含义: 1:左边框,2:右边框,3:上边框,4:下边框
 
hfpang:
按照你的方法,在运行时出现如下提示:
Undeclared identifier: 'xlContinuous'(在delphi6+excel2000)
是否需要在interface uses特殊的单元?
[8D]

 
这只是表示线形的,你可以查查VB的帮助,如果Office完全安装的话一般都有,你可以看一下
Border对象的LineStyle属性,里面有的.也许就是因为2000和XP的区别吧.
 
Sub 宏1()
'
' 宏1 Macro
' zhanglf 记录的宏 2002-12-24
'

'
Range("B5:I18").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
673
SUNSTONE的Delphi笔记
S
S
回复
0
查看
663
SUNSTONE的Delphi笔记
S
S
回复
0
查看
749
SUNSTONE的Delphi笔记
S
顶部