生成的报表如何存储在本地?

阳明腾越 2010-10-11 09:25:49
pb11开发的web程序,发布已经成功,各种查询报表都没有问题。
但是查询出来的报表,无法存储到本地计算机上,C/S下面是没有问题,“另存为”就可以选择本机上的文件夹进行存储。
发布成web程序后,使用ie登陆,查询报表,点击“另存为”的时候,不能选择本地文件夹,请问高手如何处理“存储为”的代码?急。谢谢

我的另存为的代码如下:【】内的部分

String ls_File, ls_Path, ls_Ext
GetFileSaveName("Save Report", ls_Path, ls_File, "xls", "excell Files (*.xls),*.xls, " + &
"Text Files (*.txt),*.txt, HTML Files (*.htm),*.htm")
If Trim(ls_Path) <> "" Then
ls_Ext = Lower(Right(ls_Path, 3))
Choose Case ls_Ext
Case "xls"
dw_1.SaveAsascii(ls_Path)
Case "txt"
dw_1.SaveAsascii(ls_Path, "|")
Case "htm"
dw_1.SaveAsascii(ls_Path, "|")
Case Else
MessageBox("Save Report", "The type of file saved is identified by the extension. " + &
"Use '.psr' for PSReport, '.txt' for Text, or '.htm' for HTML Table", Exclamation!, OK!)
Return
End Choose
End if
...全文
124 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
smitxx 2010-10-11
  • 打赏
  • 举报
回复
楼主保存的时候只会应用到服务器上,1楼正解
builderwfy 2010-10-11
  • 打赏
  • 举报
回复
學習了
pb8 2010-10-11
  • 打赏
  • 举报
回复
也可以通过函数得到真实的url,再设置到超链接对象中让用户下载,你自己可以试试
#if defined PBWEBFORM then
string s
s = GetDownloadFileUrl("c:\aaa.txt", false)
mle_1.text += "~r~n" + s
shl_1.url = s //shl_1: static hyperlink
#end if
pb8 2010-10-11
  • 打赏
  • 举报
回复
你需要先了解一下pb web中提到的虚拟文件系统,VFS
做WEB开发时,最主要的要改变以前的一些思路,简单点说,pb代码直接转换的一般为服务器端代码,只在服务器上运行的,作用于服务器端,只有javascript之类的脚本语言才操作到本地,这也是web安全要求的;
在VFS中,web服务器会为每个会话建立一个临时目录,你的saveas之类都是针对这个临时目录的,如果要到本地就还需要下载,下载的基本代码如下:
string docpath, docname[]
boolean lb_openinteger i, li_cnt, li_rtn, li_filenum

lb_open = true //or false
li_rtn = GetFileOpenName("Select File", docpath, & + docname[], "DOC", & + "Text Files (*.TXT),*.TXT," & + "Doc Files (*.DOC),*.DOC," & + "All Files (*.*), *.*", & "C:\Program Files\Sybase", 18)
IF li_rtn < 1 THEN returnli_cnt = Upperbound(docname)
// if only one file is picked, docpath contains the // path and file nameif li_cnt = 1 then mle_1.text = string(docpath) #if defined PBWEBFORM then DownloadFile(string(docpath), lb_open) #end ifelse
// if multiple files are picked, docpath contains // the path only - concatenate docpath and docname
for i=1 to li_cnt
string s
s = string(docpath) + "\" +(string(docname[i]))
#if defined PBWEBFORM then
DownloadFile(s, lb_open)
#end if
mle_1.text += s +"~r~n"
next
end if
PB菜鸟 2010-10-11
  • 打赏
  • 举报
回复
学习了

662

社区成员

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

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