Post
KO

html to Excel

poi를 이용해서 통계 표를 엑셀로 만들려고 했는데

여간 머리아픈게 아니였다 그러다가 문득 생각난게

html도 엑셀로 넣으면 표가 잘 나오기 때문에 해당 방법을 찾아봤는데

역시나 있었다

간단하게 해더만 속이면 되는 것이였다.

String fileName = request.getParameter("title"); response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "inline; filename="+ fileName +".xls");

이런 해더로 된 껍데기 페이지를 만들고

브라우져에서 보여지고 있는 tag들을 저쪽으로 떤져주면 파일로 떠러진다.

매우 간단한거 같다.

This article is licensed under CC BY 4.0 by the author.