apache-poi

Mapping of Apache POI HSSF/XSSF to XLS/XLSX

你说的曾经没有我的故事 提交于 2021-02-16 20:33:15
问题 Apache POI 4.x here. I see there are two types of Workbook implementations: HSSF Workbook XSSF Workbook I need to write a Java 8 app that reads Excel sheets with either " .xls " (XLS) or " .xlsx " (XLSX) extensions. Meaning, Excel files that were saved in the "old" (pre 2003) format, or the newer one. Is it safe to assume I use HSSF for XLS files, and XSSF for XLSX files? Or is the mapping logic a little bit more complicated there? This answer seems to indicate I'm correct, but that doesn't

How can I set table row's height different each column in word via apache poi

可紊 提交于 2021-02-11 15:43:04
问题 I want to create a table in my word document. In this table, I need something like this In this image, third row's third column has different height from first and second columns. I want to create something like this with apache poi but I don't find any solution for this. My codes is here table.getRow(6).setHeight(630); table.getRow(6).getCtRow().getTrPr().getTrHeightArray(0).setHRule(STHeightRule.EXACT); table.getRow(6).getCell(0).removeParagraph(0); //Cell0 XWPFParagraph row6Paragraph=table

Apache POI custom data format is modified

妖精的绣舞 提交于 2021-02-11 14:44:12
问题 I'm using Apache POI to alter an Excel file and put some data in it. Most of what I try goes well. However my currency formatting is not done 100% correctly... What I want is my currencies to be format like € 1.000,43 . So the Euro sign on the left, the amount on the right with dot as thousands separator, comma as the decimal separator and two decimals. If I do that in Excel and apply this custom formatting rule it works: "_ [$€-nl-BE] * #.##0,00_ ;_ [$€-nl-BE] * -#.##0,00_ ;_ [$€-nl-BE] * \"

XWPF POI How to setting text in paragraph without wordwrap

妖精的绣舞 提交于 2021-02-11 13:51:28
问题 XWPF Paragraph POI - I want to create paragraph but in the last text or last line in this paragraph without wordwrap. How to setting ..... Thanks.... String kalimat="Aaaa bbb ccc ddd eee fffffff ggg hhh. Jjjjj kkk lll mmm nnnn oo pppppp qqqqq rrrr sssssssss tt uuu."; paragraph = document.createParagraph(); paragraph.setAlignment(ParagraphAlignment.BOTH); paragraph.setSpacingBefore(0); paragraph.setSpacingAfter(0); paragraph.setSpacingBetween(1.5); run = paragraph.createRun(); run

how to add comment to a table of word by apache poi

◇◆丶佛笑我妖孽 提交于 2021-02-11 13:50:37
问题 I want to write a comment to a existing word document programmatically using apache poi. I have successfully added comments to the paragraph by the method mentioned here, but when adding comments to the table, I don't know how to associate it with real comments BigInteger cId = BigInteger.ZERO; ctComment = comments.addNewComment(); ctComment.setAuthor("Axel Ríchter"); ctComment.setInitials("AR"); ctComment.setDate(new GregorianCalendar(Locale.US)); ctComment.addNewP().addNewR().addNewT()

Work with checkboxes in docx file with Apache POI

99封情书 提交于 2021-02-10 20:25:16
问题 could you please help me? I need to fill checkboxes in my MS Word docx template via Apache POI. Checkboxes has been inserted by Developer tab->Controls->Checkbox and located inside paragraph -> "w:sdt" tag (not inside paragraph -> run). I've tried paragraph.getCTP().getFldSimpleList() but it returns 0 fields. So is there another way to get access for checkboxes? XML part: <w:p w:rsidR="00C81ACC" w:rsidRDefault="00C81ACC" w:rsidP="004658AE"> <w:pPr> <w:spacing w:line="276" w:lineRule="auto"/>

Error creating excel file with java dependencie

三世轮回 提交于 2021-02-10 15:49:05
问题 I found dependencies from here : https://poi.apache.org/download.html and the compilation was done at intellij idea without any error and my programm runs fine but when it tries to create the .xlsx file it gives this error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/math3/util/ArithmeticUtils at org.apache.poi.poifs.property.RootProperty.setSize(RootProperty.java:59) at org.apache.poi.poifs.property.DirectoryProperty.<init>(DirectoryProperty.java:52) at org

java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook

ε祈祈猫儿з 提交于 2021-02-10 15:41:21
问题 I was getting this exception but I am not able to understand what is happening there. Because on compilation time my class able access apache POI classes but on runtime my classes throws exception that he is not able find org.apache.poi.xssf.usermodel.XSSFWorkbook . Till now whatever solution is provided on net I have tried everything but not understanding what I am missing. And weird thing is same code and same Apache POI library working on my friend's eclipse. We both have identical

java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook

百般思念 提交于 2021-02-10 15:40:13
问题 I was getting this exception but I am not able to understand what is happening there. Because on compilation time my class able access apache POI classes but on runtime my classes throws exception that he is not able find org.apache.poi.xssf.usermodel.XSSFWorkbook . Till now whatever solution is provided on net I have tried everything but not understanding what I am missing. And weird thing is same code and same Apache POI library working on my friend's eclipse. We both have identical

Renaming headers of XSSFTable with Apache Poi leads to corrupt XLSX-file

二次信任 提交于 2021-02-09 18:06:02
问题 I am trying to rename headers of an existing xlsx-file. The idea is to have an excel-file to export data from XML to excel and reimport the XML once some user has made adjustments. At the moment we have created a "template" xlsx-sheet with Excel which already contains a sortable table (XSSFTable in poi) and a mapping to a XSD-source. Then we import it via POI, map XML data into it and save it. To adjust the sheet to the users we want to translate the headers/column-names of this existing