apache-poi

Apache POI - convert word to pdf

不羁岁月 提交于 2020-07-22 22:10:26
问题 I am trying to convert XWPFDocument to PDF but getting an error. I am using - https://mvnrepository.com/artifact/fr.opensagres.xdocreport/fr.opensagres.poi.xwpf.converter.pdf/2.0.1. <!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport /fr.opensagres.poi.xwpf.converter.pdf --> <dependency> <groupId>fr.opensagres.xdocreport</groupId> <artifactId>fr.opensagres.poi.xwpf.converter.pdf</artifactId> <version>2.0.1</version> </dependency> Code: FileInputStream fis = new FileInputStream("1

Insert a new column in between to an existing excel file using apache POI

折月煮酒 提交于 2020-07-22 21:34:05
问题 I have an excel file which have 2 columns. I want to add a new column in between existing first and second using java program. I am trying to use Apache POI for this purpose. I went through the api docs and some of the related stack over flow questions but I could find examples which only delete/update the cells(not inserting an entire column). Can any one share useful pointer to this? The only solution which I can think as if now is create a new sheet with 3 columns copy 1st column and 3rd

Apache POI is taking extremely large time to write into the Workbook

馋奶兔 提交于 2020-07-10 07:29:05
问题 I'm using Apache POI to create and save records into Workbook . I have almost 5000+ new records to be written and saved into the workbook. But at the time of writing the fileOutputStream into the workbook, the execution basically halts and slowed down. What I mean to say is, at the time of executing this line: workbook.write(fileOutputStream); it almost stops to process 5000+ records. I validated that it's taking nearly 1 hour (!) to write in the workbook. How can I improve the performance

How to generate editable Stacked-bar-chart using apache poi 4.0.1 and java?

泪湿孤枕 提交于 2020-07-07 12:25:54
问题 I want to create stacked bar chart using Apache poi 4.0.1 and Java language for Excel The output excel file's extension should be .xlsx The generated chart should have Chart title and Data Labels The generated chart should also be able to show the total sum of all data at the top of each column (you can see total for each column is shown in yellow boxes) You can refer following image for more clarity about what I'm looking for. Data for stacked bar chart Date Category High Medium Low 10/01 3

Unable to read all content in order of a word document (docx) in Apache POI

被刻印的时光 ゝ 提交于 2020-07-02 02:55:07
问题 I've been trying to read all content (including tables, pictures, paragraphs) from a word document. I'm able to read tables and paragraphs using getBodyElementsIterator() but it doesn't read pictures present inside the document. Although I'm able to read pictures seperately using getAllPictures() but I need to read everything in order. I've tried looking for XWPFPicture instance while looping inside getBodyElementsIterator() but I'm not able to find any image instance. Iterator<IBodyElement>

Unable to read all content in order of a word document (docx) in Apache POI

白昼怎懂夜的黑 提交于 2020-07-02 02:51:32
问题 I've been trying to read all content (including tables, pictures, paragraphs) from a word document. I'm able to read tables and paragraphs using getBodyElementsIterator() but it doesn't read pictures present inside the document. Although I'm able to read pictures seperately using getAllPictures() but I need to read everything in order. I've tried looking for XWPFPicture instance while looping inside getBodyElementsIterator() but I'm not able to find any image instance. Iterator<IBodyElement>

Unable to read all content in order of a word document (docx) in Apache POI

…衆ロ難τιáo~ 提交于 2020-07-02 02:50:26
问题 I've been trying to read all content (including tables, pictures, paragraphs) from a word document. I'm able to read tables and paragraphs using getBodyElementsIterator() but it doesn't read pictures present inside the document. Although I'm able to read pictures seperately using getAllPictures() but I need to read everything in order. I've tried looking for XWPFPicture instance while looping inside getBodyElementsIterator() but I'm not able to find any image instance. Iterator<IBodyElement>

Set BackgroundColor in XSSFWorkbook with Java

陌路散爱 提交于 2020-06-29 04:22:50
问题 I want to set my own backgroundcolor in XSSFWorkbook. So far i have this code: style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.RIGHT); style.setFont(itemFont); style.setFillForegroundColor(new XSSFColor(new java.awt.Color(128, 0, 128))); styles.put("item_right", style); But i got the following error: The method setFillForegroundColor(short) in the type CellStyle is not >applicable for the arguments (XSSFColor) The constructor XSSFColor(Color) is deprecated So how can i

Set BackgroundColor in XSSFWorkbook with Java

笑着哭i 提交于 2020-06-29 04:21:11
问题 I want to set my own backgroundcolor in XSSFWorkbook. So far i have this code: style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.RIGHT); style.setFont(itemFont); style.setFillForegroundColor(new XSSFColor(new java.awt.Color(128, 0, 128))); styles.put("item_right", style); But i got the following error: The method setFillForegroundColor(short) in the type CellStyle is not >applicable for the arguments (XSSFColor) The constructor XSSFColor(Color) is deprecated So how can i

Invalid header signature when read any xls file

こ雲淡風輕ζ 提交于 2020-06-29 03:40:36
问题 When I try to read xls file using the code below, I always get error: org.apache.poi.poifs.filesystem.NotOLE2FileException: Invalid header signature; read 0x65572D2D2D2D2D2D, expected 0xE11AB1A1E011CFD0 - Your file appears not to be a valid OLE2 document. This is my code: public Result<List<IDto>> ReadExcelClassInfo2003(File file, Timestamp createTime, Timestamp updateTime, BigDecimal createBy, BigDecimal updateBy) { Result<List<IDto>> resultData = new Result<List<IDto>>(); Integer