мы можем использовать jxl для приложения Google App Engine? - PullRequest
1 голос
/ 05 сентября 2011

Можем ли мы использовать JXL (Java Excel API) для создания файла Excel в приложении Google App Engine?

Кроме того, как создать файл Excel в сервлете для приложения ядра приложений Google?

1 Ответ

3 голосов
/ 06 сентября 2011

Да, вы можете!

Следуйте инструкциям, чтобы узнать о JXL .

Чтобы создать рабочую книгу внутри сервлета:

  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();
  }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...