3월, 2013의 게시물 표시

Spring PDF Example

  @RequestMapping (value="/pdf" )   public void pdfCreate(HttpServletResponse response, OutputStream outputStream){   Document document = new Document();        try {                   // 파일 출력 -      FileOutputStream file = new FileOutputStream(new File("C:/HelloWorld.pdf"));  // File Write                   PdfWriter.getInstance(document, file);                     // Stream Output           PdfWriter.getInstance(document, outputStream);                     document.open();           //           // Create our first paragraph for the pdf document to be           // created. We also set the alignment and the font ...

Spring Excel Example

@RequestMapping(value = "/excel", method = RequestMethod.GET) public void handleRequestInternal(HttpServletRequest request,                                  HttpServletResponse response,                                  OutputStream outputStream    ) throws Exception { response.setHeader("Content-Disposition", "attachment; filename=file.xls"); //ModelAndView model = new ModelAndView("excel"); // Creating an instance of HSSFWorkbook.         HSSFWorkbook workbook = new HSSFWorkbook();         // Create two sheets in the excel document and name it First Sheet and         // Second Sheet.         HSSFSheet firstSheet  = workbook.createSheet("FIRST SHEET");         HSSFSheet secondShe...