That is essentially it.

Here is an example:

public class InlineServlet extends HttpServlet {

        public void doGet(HttpServletRequest request, HttpServletResponse 
response) throws IOException {
        try {
            response.setContentType("application/vnd.ms-excel");
            // experiment with either inline or attachment. IE settings can 
override this behavior.
            response.setHeader("Content-disposition", 
"inline;filename=inline.xls");
            // response.setHeader("Content-disposition", 
"attachment;filename=inline.xls");
            write(response.getOutputStream());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public void write(OutputStream out) throws Exception {
        HSSFWorkbook wb = new HSSFWorkbook();
        write(wb);
        wb.write(out);
    }

    ...

}

Regards,
Dave

On Dec 1, 2010, at 8:05 AM, Gabriel Molina wrote:

> You may let a Servlet produce an Excel file as an output.
> Your users will download the file and will view it externally to the
> browser, except if they are using IE they will see it embeded.
> 
> There is no way to embed the application (MS Excel) in a web browser
> other than IE, or at least without plugins (don't know if even
> exists).
> 
> The best solution for this could be to open the file using POI to
> extract information an let the user view this
> information using html/javascript (say using JSP, JSF, etc).
> 
> There will be some code done for this, try googling for these solutions.
> 
> Regards
> 
> On Wed, Dec 1, 2010 at 3:01 AM, Saravanan P <saravanan....@gmail.com> wrote:
>> *Hi All,
>> 
>>            I want to open an Excel file in browser using JAVA...
>> 
>> 
>> Is there any way to do that?
>> 
>> **Thanks & Regards,
>> 
>> Saravanan.P
>> *
>> *
>> ***************************************************************************************
>> Never Design your life like GARDEN, any one can walk...!
>> So, Design your life like SKY where every one has aspire to reach...!
>> ***************************************************************************************
>> *
>> 
> 
> 
> 
> -- 
> ちりも積もれば山となる
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
> For additional commands, e-mail: user-h...@poi.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
For additional commands, e-mail: user-h...@poi.apache.org

Reply via email to