我们可以使用jxl进行谷歌应用引擎应用吗?

时间:2011-09-05 11:13:56

标签: google-app-engine

我们可以使用jxl(java excel api)在google app引擎应用程序中生成excel文件吗?

还告诉我如何在servlet中为google app引擎应用程序生成excel文件?

先谢谢了.......

1 个答案:

答案 0 :(得分:3)

是的,你可以!

Follow the tutorial to learn about JXL

在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();
  }