apache-poi

Data provider mismatch in Selenium with TestNG

你。 提交于 2019-12-12 04:06:29
问题 I am writing the below code in selenium and below error is showing, please let me know where is the issue. import org.testng.annotations.DataProvider; import org.testng.annotations.Test; public class testngexcel { public static ExcelReader excel = null; @Test(dataProvider = "newdata") public void testData(String username, String password, Integer age) { System.out.println(username + " - " + password + " - " + age); } @DataProvider(name = "newdata") public static Object[][] getData() { if

Using POI or Tika to extract text, stream-to-stream without loading the entire file in memory

天涯浪子 提交于 2019-12-12 04:05:10
问题 I'm trying to use either Apache POI and PDFBox by themselves, or within the context of Apache Tika, to extract and process plain text from MASSIVE Microsoft Office and PDF files (i.e. hundreds of megs in some cases). Also, my application is multi-threaded, so I will be parsing many of these large files concurrently. At that scale, I MUST work with the files in a streaming manner. It's not an option to hold an entire file in main memory at any step along the way. I have seen many source code

Workarounds for using apache poi 3.9 with JDK 4

若如初见. 提交于 2019-12-12 03:56:51
问题 This is a follow up question here . I just found this caption in Apache POI website. POI 3.5 and later requires the JDK version 1.5 or later. Versions prior to 3.5 require JDK 1.4+ Clearly, that's the reason I can't build my Java program. I would just like to know if there are any workarounds where I can successfully build my project in Ant using my current settings. Settings Apache POI - 3.9 JDK - 1.4.2 (4.0) Any advice, tips, or hacks are welcome. Thanks in advance! 回答1: Java 1.4 is pretty

Is it possible to set the active range with Apache POI XSSF?

自作多情 提交于 2019-12-12 03:54:31
问题 I am using Apache POI XSSF to read and write Excel Sheets. I know that I can set the active cell on a worksheet by using Sheet.setActiveCell(CellAddress address) . However, I'd like to set it to a Range containing more than one cell on the sheet, as illustrated by the picture below: When I save a sheet with multiple cells selected using Excel those are selected upon opening the saved file. Is there a way to do this with POI XSSF? 回答1: you can use following line to achieve a ranke as active

I want to Create a password protected excel file using Apache POI, and then give to for download to Servlet.getOutputStream()

别说谁变了你拦得住时间么 提交于 2019-12-12 03:52:24
问题 I don't have permission to save files to the filesystem. All the examples I could find online are using filesystem. I want to create workbook in memory as below: HSSFWorkbook workbook = new HSSFWorkbook(); Write data to workbook... Make the workbook password protected.? Then write the workbook to output stream as below: workbook.write(servlet.getOutputStream()); 回答1: I was able to get the following to work with an HttpServlet and HSSFWorkbook .xls file - WorkbookServlet.java: package com

Excel file gets corrupted when i change the value of any cell in the header (Columns Title)

大城市里の小女人 提交于 2019-12-12 03:43:50
问题 I'm trying to read and Xslx file using JAVA POI, edit it and save it. But when i change any cell value on row#0 (Header) the output file gets corrupted. Excel can recover the file by repairing, Table from /xl/tables/table.xm . FileInputStream file = new FileInputStream("inventorywithbin431.xlsx"); XSSFWorkbook workbook = (XSSFWorkbook) WorkbookFactory.create(file); XSSFSheet rawdata = workbook.getSheetAt(0); String[] headers = new String[] { "ItemCodeNoFRU","Company","ItemCode","ItemName",

Error:Execution failed for task ':app:transformClassesWithDexForDebug' after adding poi-ooxml:3.7 library

我的未来我决定 提交于 2019-12-12 03:35:48
问题 I want to read a XLSX file, so I am using org.apache.poi:poi-ooxml:3.7 Now I have done everything, no errors so far, but when I am running the application, Android Studio is giving me a weird error Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0\bin\java.exe'' finished with non

Issues instantiating NPOIFSFileSystem Object with File

…衆ロ難τιáo~ 提交于 2019-12-12 03:34:41
问题 First up I am asking this question from home =- away from all the source; I will attempt to update tomorrow. Essentially I am instantiating NPOIFSFileSystem like so: NPOIFSFileSystem fs = new NPOIFSFileSystem(new File(this.getLocalFile())); The getLocalFile() method returns a String to a file path - I know the file exists in that location. However, the instatiation is returning an error: ArrayIndexOutOfBounds Does anyone have any ideas on this at all? The file in question is an XLS file, it

JAVA Apache POI Custom Format

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 03:32:22
问题 I am Using poi version : 3.14 I access an Excel ( .xlsx ) file this.workbook = WorkbookFactory.create(new FileInputStream(f.getPath())); this.workbook.setMissingCellPolicy(Row.CREATE_NULL_AS_BLANK); this.sheet = workbook.getSheetAt(0); Here is a custom format found in .xlsx file applied to a cell. I want to display the cell value in my code. As you can see the cell value visible in file is "031642153283700100". Also when i clic on this particular cell, value is changing to "42153283700100"

Adding a row to a large xlsx file (Out of Memory)

这一生的挚爱 提交于 2019-12-12 03:09:09
问题 The situation is as follows; I have a simple program which uses the Apache Poi Library to add one row of data at the end of the an exisiting xlsx file. See below File file = new File(input); XSSFWorkbook workbook = new XSSFWorkbook(file); XSSFSheet sheet = workbook.getSheetAt(0); XSSFRow row = sheet.createRow(sheet.getLastRowNum() + 1); After this I will iterate over the row and set the CellValues. But the problem is that on the second line of the code, as shown above, I get an out of memory