Also, make sure to read in the HTTP_ACCEPT client variables to find out
whether the browser supports the type "application/vnd.ms-excel"

--
Antonio W. Lagnada
[EMAIL PROTECTED] - email

This email address is specifically
for JSP-Interest email list


---- "David M. Karr" <[EMAIL PROTECTED]> wrote:
> >>>>> "hua" == hua ge <[EMAIL PROTECTED]> writes:
>   hua> Hi,
>   hua> I have a html search result page (done in jsp/servlet) containing
> lines of
>   hua> found records.
>
>   hua> our client like to set up a save button on this page and it
> will invoke word
>   hua> or excel window which will contain all the result data in Text(tab
> delimited
>   hua> .txt) format or in CSV(Comma delimited .csv). then they can
> save as the
>   hua> files to their local disk.
>
>   hua> can someone share some idea or offering some sample code to
> implement this
>   hua> kind of application?
>
>   hua> I assume I can set ContextType to some MIME type to invoke excel
> or word,
>   hua> but how the data in the page can be transfored to the excel
> or word in a
>   hua> certain format? I need detailed help.
>
> The text format for excel is very simple.  Each field is separated
> by
> a tab, and each line is separated by a newline.
>
> If the contentType is "application/vnd.ms-excel", then the browser
> will interpret it as an excel document, on Windows, at least.  With
> IE, it puts it in the browser window, and in netscape, it has to open
> a separate Excel window (unless there is some way to integrate it into
> the browser window, which I'm not familiar with).
>
> So your operation could execute a servlet which would just set the
> contentType, and output the data in tab-delimited format.
>
> For an example, pick up the book "Core Servlets and JavaServer Pages",
> and look at page 254, for the section "Generating Excel Spreadsheets".
>
> --
> ===============================================================================
> David M. Karr     ; [EMAIL PROTECTED]  ; w:(425)487-8312 ; TCSI & Best
> Consulting
> Software Engineer ; Unix/Java/C++/X ; BrainBench CJ12P (#12004)
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

___________________________________________________________________
To get your own FREE ZDNet Onebox - FREE voicemail, email, and fax,
all in one place - sign up today at http://www.zdnetonebox.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to