用什么函数可以设置单元格的格式为文本啊,请各位帮忙?

cumtbrainman 2005-08-06 10:14:34
本人写的一个报表程序,大体是这样的:
先在报表导入模块,导入报表模板,然后填充数据库的数据
但是填充是出了问题:
填煤层名称时,煤层名称是2-3,但是显示出来是日期格式 20005-2-3
我在excel中该单元格格式为文本,但是在程序中不认,各位大侠能不能告诉我用什么函数可以让单元格的格式为文本?
我的代码如下:
oleobject Cellformat
cellformat = w_printexcel.ole_1.object.CreateNewCellFormat

w_printexcel.ole_1.object.setrowheight(ll_currow,ll_currow,420,false)//设置行高
w_printexcel.ole_1.object.setactivecell(7,3)
cellformat = w_printexcel.ole_1.object.GetCellFormat
w_printexcel.ole_1.object.setactivecell(ll_currow,3)
w_printexcel.ole_1.object.SetCellFormat(cellformat)
if not isnull(ls_mcmc[n]) then
w_printexcel.ole_1.object.Entry = ls_mcmc[n]//煤层名称
end if

还有就是怎么能够合并单元格? 我用:
w_printexcel.ole_1.object.setselection((ll_currow - m - 1),2,ll_currow ,2)
并没有成功,不知道为什么
...全文
265 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
eshowsoft 2005-08-14
  • 打赏
  • 举报
回复
日期对应日期不就就得了,' 20005-2-3'这个是什么日期格式,我也看不懂,在excel中不是也可以格式化日期吗?然后将你的dw也将日期格式化了,在EDITMASK里去做就行了。
BES 2005-08-08
  • 打赏
  • 举报
回复
Range.Columns[J-K].NumberFormatLocal := '@';
这是DELPHI的语法,但主要你记住文本的格式码是'@'就行了,接口属性为NumberFormatLocal
cumtbrainman 2005-08-07
  • 打赏
  • 举报
回复
各位帮帮忙啊,
cumtbrainman 2005-08-06
  • 打赏
  • 举报
回复
各位大侠帮帮忙把,谢了,本人在线等
cumtbrainman 2005-08-06
  • 打赏
  • 举报
回复
怎么没人回复啊,自己顶上来,

611

社区成员

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

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