|
Jim, I'm not sure, I've never tried it. opening a .csv or .xls in IE actually opens excel in the browser, so I'm pretty sure it would work the same way using the technique below. once in the browser, the user could choose 'file/save' to save a copy locally. Scott says you don't have to create the data as a file on the IFS, and instead send it directly to the browser, but I don't know how to do that. if you go in this direction, be sure to read his critiques about duplicate file names, IFS clean up, etc. Rick On 12/29/06, Jim Horn <jimh@xxxxxxxxxxxxxx> wrote:
Thanks again Yes we intend to have the option to send html/pdf and probably xls back to the user. The tool will allow us to create them easily from either a spool file or an sql statement. We (or the user in some cases) will be able to request what the return output will be. Can code similar to that below also be used to return an excel file? Jim ====================================================== message: 10 date: Thu, 28 Dec 2006 15:28:24 -0500 from: "rick baird" <rick.baird@xxxxxxxxx> subject: Re: reading pdf/html from ifs send via cgidev2 FYI, for the code below, the standard out to the browser looks like this: Content-Type: Text/HTML Pragma: no-cache' Expires: 0 Cache-Control: no-cache <html><script language=JavaScript> var pdfWindow = window.open("//webdirectory/pdfs/mypdffilename.pdf","pdfWindow","scrollbars, resizable,width=750,height=540"); pdfWindow; pdfWindow.moveTo(3,3); history.back(); </script></html> On 12/28/06, rick baird <rick.baird@xxxxxxxxx> wrote: > I'm not very well versed in how cgidev2 works (just played briefly > with it) but.... > > If you can already create the PDF and can give it a unique name via > the CGI program, the program can tell the browser to open the pdf in a > separate window by pushing the following code back to the browser via > std out - (this is the only reply the browser receives from the CGI > report request): > > C eval OutStr = 'Content-Type: Text/HTML' + > C $CrLf + 'Pragma: no-cache' + > C $CrLf + 'Expires: 0' + > C $CrLf + 'Cache-Control: no-cache' + > C $CrLf + $CrLf + > C '<html><script language=JavaScript>' + > C $CrLf + > C 'var pdfWindow = window.open("' + > C %trim(PDFPATH) + ",' + > C '"pdfWindow","scrollbars,resizable,' + > C 'width=750,height=540");'+ $CrLf + > C 'pdfWindow;' + $CrLf + > C 'pdfWindow.moveTo(3,3);' + $CrLf + > C 'history.back();' + $CrLf + > C '</script></html>' > C exsr $APIStdOut > > - PDFPATH is the webserver defined path to the IFS location and file > name. example: > > /webdirectory/pdfs/mypdffilename.pdf > > the code will open a new window, and the pdf extension tells the > browser to open adobe reader and download the file. > > after the new window is displayed, the original browser will return - > using history.back() - to the page that requested the report. > > hope this helps a little. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.