开发者

can we use jxl for google app engine application?

开发者 https://www.devze.com 2023-04-02 06:21 出处:网络
Can we use JXL (Java Excel API开发者_运维百科) to generate Excel file in Google app engine application?

Can we use JXL (Java Excel API开发者_运维百科) to generate Excel file in Google app engine application?

Also, how to generate Excel file in servlet for Google app engine application?


Yes you can!

Follow the tutorial to learn about JXL.

To create a Workbook inside a servlet:

  protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
    // Specifying in the response headers that a file is gonna be returned
    resp.setContentType("application/x-download");
    // Specifying the name of the file
    resq.setHeader("Content-Disposition", "attachment; filename=MyName.xls");

    // Create the workbook with the output stream of the response
    WritableWorkbook jxlWorkbook = Workbook.createWorkbook(resp.getOutputStream());
    // Do your stuff
    // ...

    // Finally close the stream
    resp.getOutputStream().close();
  }
0

精彩评论

暂无评论...
验证码 换一张
取 消