关于数据窗口中另存为的问题

wjzustjava 2004-11-03 10:20:22
---关于数据窗口中另存为的问题---

在数据窗口中可以新增加按钮。那按钮可以有另存为的功能
但是程序运行时我用另存为时。数据窗口的标题没有保存。
只有数据保存了。怎么让标题也跟着保存啊
...全文
164 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
fengbailing 2005-01-28
  • 打赏
  • 举报
回复
保存文件时指定一个excel文件名即可,如a.xls
fengbailing 2005-01-28
  • 打赏
  • 举报
回复
为什么不这样试试?
string l_filepath
GetFilesaveName('保存文件',l_filepath,l_filename)

setpointer(HourGlass!)
IF dw_1.saveasascii(l_filepath)=1 THEN
messagebox('操作提示','已成功另存至文件:'+l_filepath)
ELSE
messagebox('操作提示','另存失败!')
END IF
setpointer(Arrow!)
sinllysin 2004-11-04
  • 打赏
  • 举报
回复
请问高手,我用OLE如何把数据窗口的汇总栏也导入EXCEL中?程序如下:

integer filevalue
string filepath,filename

IF dw_query.rowcount()=0 then
messagebox("提示:", "没有符合条件的信息")
return
End If
filevalue = GetFileSaveName("选择文件", &
+ filepath, filename, "excel", + "excel Files (*.xls),*.xls" )

if filevalue<>1 then return

OLEObject ole_object , ole_workbooks

ole_object = CREATE OLEObject
IF ole_object.ConnectToNewObject("Excel.Application") <> 0 THEN
MessageBox('OLE错误','OLE无法连接!')
return
END IF
ole_object.workbooks.add
ole_object.Visible = True
ole_workbooks = ole_object.Worksheets(1)
ole_workbooks.cells(1,1).value="机种"
ole_workbooks.cells(1,2).value="品名"
ole_workbooks.cells(1,3).value="图番"
ole_workbooks.cells(1,4).value="取数"
ole_workbooks.cells(1,5).value="材质"
ole_workbooks.cells(1,6).value="计划累计"
ole_workbooks.cells(1,7).value="成形累计"
ole_workbooks.cells(1,8).value="计量累计"
ole_workbooks.cells(1,9).value="不良累计"
ole_workbooks.cells(1,10).value="生产时间累计"
ole_workbooks.cells(1,11).value="损失时间累计"
ole_workbooks.cells(1,12).value="不良率平均"
ole_workbooks.cells(1,13).value="生产率平均"
ole_workbooks.cells(1,14).value="计划完成率平均"


debugbreak()
long l_row,li_next
string ls_qs
for l_row = 1 to dw_query.rowcount()
li_next=l_row+1
ls_qs=left(dw_query.getitemstring(l_row,4),1)//取数
ole_workbooks.cells(li_next,1).value=dw_query.getitemstring(l_row,1)
ole_workbooks.cells(li_next,2).value=dw_query.getitemstring(l_row,2)
ole_workbooks.cells(li_next,3).value=dw_query.getitemstring(l_row,3)
ole_workbooks.cells(li_next,4).value=ls_qs
ole_workbooks.cells(li_next,5).value=dw_query.getitemstring(l_row,5)
ole_workbooks.cells(li_next,6).value=dw_query.getitemdecimal(l_row,6)
ole_workbooks.cells(li_next,7).value=dw_query.getitemdecimal(l_row,7)
ole_workbooks.cells(li_next,8).value=dw_query.getitemdecimal(l_row,8)
ole_workbooks.cells(li_next,9).value=dw_query.getitemdecimal(l_row,9)
ole_workbooks.cells(li_next,10).value=dw_query.getitemdecimal(l_row,10)
ole_workbooks.cells(li_next,11).value=dw_query.getitemdecimal(l_row,11)
ole_workbooks.cells(li_next,12).value=dw_query.getitemdecimal(l_row,12)
ole_workbooks.cells(li_next,13).value=dw_query.getitemdecimal(l_row,13)
ole_workbooks.cells(li_next,14).value=dw_query.getitemdecimal(l_row,14)

next

ole_workbooks.SaveAs (filepath)
messagebox("提示:","保存成功!")

ole_object.quit()
Ole_Object.DisConnectObject()
Destroy Ole_Object
destroy ole_workbooks
lovemoreh 2004-11-04
  • 打赏
  • 举报
回复
用saveas("", excel!, true),其中末一个参数即表示存储时带标题头,
用这种语法还可以让用户自己选择用哪种文件格式,是否带标题头。
xuam 2004-11-03
  • 打赏
  • 举报
回复
用saveasascii()可以!
青锋-SS 2004-11-03
  • 打赏
  • 举报
回复
你是指的数据窗口中各列的标题(列名)呢还是数据窗口中报表的标题,好像不能导出报表的标题吧.
linda_gao 2004-11-03
  • 打赏
  • 举报
回复
do u mean the file just includes data but no header ? I tried PB9 , it works well via DW button.
sdkong 2004-11-03
  • 打赏
  • 举报
回复
最好用saveasascii(),它比较通用,自已画的报表也可导出
li_d_s 2004-11-03
  • 打赏
  • 举报
回复
saveas("*.txt", Text!, True)

1,079

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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