如何控制EXCEL的CELL中的内容自动居中!(急!)

sundayboys 2003-07-01 01:44:38
我现在将一个DBGrid的数据导入到EXCEL中,可无法控制让CELL的内容自动居中,所以看起来很难看,如何在程序中控制我导入的数据在CELL中自动居中呢???


http://expert.csdn.net/Expert/topic/1977/1977513.xml?temp=.5770685

等待答复,可以在两个帖子中给分!
...全文
389 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
DWGZ 2003-07-01
  • 打赏
  • 举报
回复
excelworksheet1.Cells.Item[1,1].HorizontalAlignment := xlCenter;
excelworksheet2.Cells.Item[2,1].VerticalAlignment:= xlVAlignCenter;
sundayboys 2003-07-01
  • 打赏
  • 举报
回复
用WWWWA的方法搞定,不过我没有找到xlCenter的定义就用3来代替!结账!
sundayboys 2003-07-01
  • 打赏
  • 举报
回复
楼上的,那个我在大富翁bbs看过,可按你在另外一个帖子给的方法试验了一下,好像没有效果,你能不能给我一个例子代码看看啊!
firetoucher 2003-07-01
  • 打赏
  • 举报
回复
> i.?面水平居中:
> ExcelID.ActiveSheet.PageSetup.CenterHorizontally := 2/0.035;
> j.?面垂直居中:
> ExcelID.ActiveSheet.PageSetup.CenterVertically := 2/0.035;
看帖
http://expert.csdn.net/Expert/topic/1921/1921924.xml?temp=.1282312
WWWWA 2003-07-01
  • 打赏
  • 举报
回复
excelworksheet1.Cells.Item[1,1].HorizontalAlignment := xlCenter;
excelworksheet2.Cells.Item[2,1].VerticalAlignment:= xlVAlignCenter;
shenjhshen 2003-07-01
  • 打赏
  • 举报
回复
Range.HorizontalAlignment:=3;//xlCenter(水平对齐方式)
Range.VerticalAlignment:=2;//xlCenter(垂直对齐方式)
shenjhshen 2003-07-01
  • 打赏
  • 举报
回复
Sheet.PageSetup.CenterHorizontally:=true;//是否水平居中
Sheet.PageSetup.CenterVertical:=true;//是否垂直居中

2,507

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧