apache-poi

Spring Boot Controller export an Excel

陌路散爱 提交于 2021-02-06 09:20:09
问题 I have a java/spring boot application where I want to build an API endpoint that creates and returns a downloadable excel file. Here is my controller endpoint: @RestController @RequestMapping("/Foo") public class FooController { private final FooService fooService; @GetMapping("/export") public ResponseEntity export() { Resource responseFile = fooService.export(); return ResponseEntity.ok() .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename="+responseFile.getFilename())

Unable to open Excel file after excecuting my java apache poi program and i am using file output stream

折月煮酒 提交于 2021-02-05 11:56:20
问题 I am using Apache poi to extract Mysql data to an Excel file. The code is running correctly but when I am trying to open the excel file it is showing error. package com.telkomsel.excel; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.HashMap; import org.apache.poi.xssf

Unable to open Excel file after excecuting my java apache poi program and i am using file output stream

早过忘川 提交于 2021-02-05 11:56:18
问题 I am using Apache poi to extract Mysql data to an Excel file. The code is running correctly but when I am trying to open the excel file it is showing error. package com.telkomsel.excel; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.HashMap; import org.apache.poi.xssf

Encoding issue with apache poi converter

我的未来我决定 提交于 2021-02-05 11:19:12
问题 I have an ms word doc file that i'm converting to an html document using apache poi. this is the code i'm running InputStream input = new FileInputStream (path); HWPFDocument wordDocument = new HWPFDocument (input); WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter (DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument() ); List<Picture> pics = wordDocument.getPicturesTable().getAllPictures(); if (pics != null) { for (int i = 0; i <pics.size(); i++) { Picture

Java compiler errors in DDE on new computer, works fine in old one

房东的猫 提交于 2021-02-05 08:36:52
问题 I have 2 computers running Domino Designer, On my new one I get java errors in a server based application and not on the old one. I have installed the required package on both machines and I have the same compiler set in prefs. The computer with errors is a new one running windows 10 and DDE 11.0.1 FP1 and the old one is running Windows 7 and DDE 11.0.1 there is probably some paths or something that I have forgotten to set but can't find it. what can be the cause of these errors on my new

Java compiler errors in DDE on new computer, works fine in old one

梦想与她 提交于 2021-02-05 08:36:39
问题 I have 2 computers running Domino Designer, On my new one I get java errors in a server based application and not on the old one. I have installed the required package on both machines and I have the same compiler set in prefs. The computer with errors is a new one running windows 10 and DDE 11.0.1 FP1 and the old one is running Windows 7 and DDE 11.0.1 there is probably some paths or something that I have forgotten to set but can't find it. what can be the cause of these errors on my new

Java compiler errors in DDE on new computer, works fine in old one

此生再无相见时 提交于 2021-02-05 08:36:12
问题 I have 2 computers running Domino Designer, On my new one I get java errors in a server based application and not on the old one. I have installed the required package on both machines and I have the same compiler set in prefs. The computer with errors is a new one running windows 10 and DDE 11.0.1 FP1 and the old one is running Windows 7 and DDE 11.0.1 there is probably some paths or something that I have forgotten to set but can't find it. what can be the cause of these errors on my new

How to add continuous section break to XWPFDocument?

核能气质少年 提交于 2021-02-05 07:49:26
问题 I would like to have 2 sections on the same page in XWPFDocument. First section should have only 1 column, second section should have 2 columns. Currently, I am using following code: CTBody body = document.getDocument().getBody(); // 1-column section section = body.addNewSectPr(); columns = CTColumns.Factory.newInstance(); columns.setNum(new BigInteger("1")); section.setCols(columns); paragraph = document.createParagraph(); paragraph.getCTP().addNewPPr().setSectPr(section); run = paragraph

How to set data (number) format locale for specific cell using Apache POI (SXSSF)?

偶尔善良 提交于 2021-02-04 21:34:24
问题 The problem is very concrete: using Apache POI, I want to create cell (done), assign number format to it (done), and set format's locale ( stuck here ). The code looks like this: SXSSFWorkbook workbook = new SXSSFWorkbook(100); Sheet sheet = workbook.createSheet(); Row row = sheet.createRow(1); Cell cell = row.createCell(0); CellStyle cellStyle = workbook.createCellStyle(); cellStyle.setDataFormat(8); //currency with thousands separator and two decimal places after period cell.setCellValue

How to get datavalidation source for a cell in java using poi?

不想你离开。 提交于 2021-01-29 22:14:12
问题 I have defined a list of valuses my_list in one excel sheet as follow: In another excel sheet, I reference for some cells to that list sothat this list is shown as dropdown in the cell as follows: Using poi, I go throw excel sheet rows/columns and read cells for cell. I get value of cells using method: cell.getStringCellValue() My question is how to get the name of the list my_list from the cell? 回答1: This problem contains multiple different problems. First we need get sheet's data