apache-poi

How to extract a list of external references from a excel file

吃可爱长大的小学妹 提交于 2020-03-20 06:42:23
问题 I'm working on setting up an automated processing system for a (ever growing) unstructured collection of excel documents. The collection consists of both old-school .xls files and new .xlsx files. In my Java-based solution I am already making use of the Apache POI toolkit to analyse the documents. One challenges that I have not been able to tackle yet, is how to identify links between documents so as to chart dependencies. I have not yet been able to figure out how to conveniently extract a

How to split a excel file into multiple files based on row count using apache poi?

…衆ロ難τιáo~ 提交于 2020-03-19 03:04:31
问题 I am new to apache poi, I wanted to split a excel file into multiple files based on row count. E.g data.xlsx has 15k rows, new files should be like data_1.xlsx with 5k rows,data_2.xlsx should be 5-10k and data_3.xlsx should be 10-15k. 回答1: I've got you. package com.industries.seanimus; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.poi.EncryptedDocumentException; import org.apache.poi

How to split a excel file into multiple files based on row count using apache poi?

亡梦爱人 提交于 2020-03-19 03:03:52
问题 I am new to apache poi, I wanted to split a excel file into multiple files based on row count. E.g data.xlsx has 15k rows, new files should be like data_1.xlsx with 5k rows,data_2.xlsx should be 5-10k and data_3.xlsx should be 10-15k. 回答1: I've got you. package com.industries.seanimus; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.poi.EncryptedDocumentException; import org.apache.poi

HSSF POI : How to know if data in cell is of Type Date?

强颜欢笑 提交于 2020-03-14 07:05:27
问题 Currently i have my code as bean.setREPO_DATE(row.getCell(16).getDateCellValue()); it works fine if cell is formatted as date in excel. However it also converts some integer or long like 1234 or 5699 to date. I know the reason behind this too. However i want to apply a check before executing above line. Something like this if(row.getCell(16).isOfDateFormat){ bean.setREPO_DATE(row.getCell(16).getDateCellValue()); } Please Guide me.. Thanks in Advance ! 回答1: Try this, use import org.apache.poi

Get the excel workbook password using Apache POI

孤人 提交于 2020-03-05 10:42:26
问题 I am trying to read an excel sheet of data, I am able to get the data and read it using HSSFWorkbook Everything works well, I am able to get the data. I have set a password for the workbook, manually in the excel sheet Protect Workbook to "ABCXYZ" and while opening the excel file it will ask me the password and only after the password in correct it lets me in to write or read the excel file. My question is how to get this password "ABCXYZ" in the java program. HSSFWorkbook wb = new

Apache POI recording only 1 row in the spreadsheet

*爱你&永不变心* 提交于 2020-03-05 06:06:54
问题 I am using selenium and java to scrape data on a specific site, but with the code below I can write only 1 data in the spreadsheet, it is not recording all the data in sequence as it should be. I can't structure the loop correctly. public void gravarDados() throws IOException { int i = 0; File localPlanilha = new File("tools/resultado_da_pesquisa.xlsx"); FileInputStream planilhaExistente = new FileInputStream(localPlanilha); XSSFWorkbook plan = new XSSFWorkbook(planilhaExistente); XSSFSheet

Merging two document and convert to pdf - APACHE POI

谁说胖子不能爱 提交于 2020-03-05 06:05:30
问题 I have managed to merge two documents using Apache POI XWPFDocument and CTBody class. However, when opening the merged documents it gives an unsupported format so I tried to save it as pdf format but the same issue persist. I am using https://mvnrepository.com/artifact/fr.opensagres.xdocreport/fr.opensagres.poi.xwpf.converter.pdf/2.0.2 I have tried this - https://www.programcreek.com/java-api-examples/index.php?api=org.apache.poi.xwpf.converter.pdf.PdfConverter the main goal of the

How to set bold font using the latest apache poi?

大兔子大兔子 提交于 2020-03-05 05:12:30
问题 I used the latest apache poi <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.17</version> </dependency> but I cannot set bold font, below code does not work font.setBold(true); because the default it true set a boolean value for the boldness to use. If omitted, the default value is true. and does not exist setBoldWeight method either So how can I set bold weight in the latest apache poi? code XSSFWorkbook wb = new XSSFWorkbook() XSSFSheet sheet =

Creating a checkbox in XLSX using Apache POI (Java)

橙三吉。 提交于 2020-03-05 03:09:45
问题 I need to create an Excel checkbox in an XSSFSheet, but I have found no obvious classes/methods for doing so in the Java Apache POI library (4.0.1), nor any examples. Any suggestions? 回答1: There are two types of controls possible in Microsoft Excel . There are the legacy form controls and ActiveX controls. Creating legacy form controls would be possible. ActiveX controls wold be much more complex. The legacy form controls are stored in VML drawings per sheet. Apache poi has a XSSFVMLDrawing

Creating a checkbox in XLSX using Apache POI (Java)

对着背影说爱祢 提交于 2020-03-05 03:09:08
问题 I need to create an Excel checkbox in an XSSFSheet, but I have found no obvious classes/methods for doing so in the Java Apache POI library (4.0.1), nor any examples. Any suggestions? 回答1: There are two types of controls possible in Microsoft Excel . There are the legacy form controls and ActiveX controls. Creating legacy form controls would be possible. ActiveX controls wold be much more complex. The legacy form controls are stored in VML drawings per sheet. Apache poi has a XSSFVMLDrawing