I’m attempting to create an xlsx workbook object with Apache-POI by passing my .xlsx as a resource stream: I can successfully instantiate the workbook when passing my template.xlsx through a FileInputStream and a local file path, but when I pass the resources stream I get an exception: The .xlsx I’m passing shouldn’t be zipped, but maybe that’s how it works
Tag: apache-poi
Apache POI Excel row color is only black and doesn’t change
I am trying to make excel files background one row white and other aqua color. But for some reason whatever I do the color always changes to black. It doesn’t change whatever I do, even if I try GREY_25_PERCENT its completely black. Here’s picture of my excel file Answer It may seem counterintuitive, but using in combination with sets the
Not able to set custom color in XSSFCell Apache POI
I am trying to set some custom(from hexcode or rgb value) color to a xssfcell.But the color of the cell is becoming black even though I am giving some other color.I have tried doing this by the following ways : //END of the program I tried many other ways mentioned in answers to related questions but none of those solved
Java how to user JFileChooser to save a excel file created by Apache POI
I want to save a spreadsheet file to a user custom file folder, people suggest to use JFileChooser, but I actually don’t know how to achieve it. I have my current example code here: Currently it only save the file to the default project directory. But I want it to be saved to a user selected path with a user
NoClassDefFoundError org/apache/poi/ss/usermodel/Workbook
I am running a shell script which calls a java class to get some data from database and create an excel report with that data. I get the error Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook when the code hits the below line in my java class: This is how I have defined the classpath: I verified that the jars have
Reading excel file columns based on header in Spring Batch
We have requirement to read the huge excel file in java. I am prefering Spring Batch for same ,as we have spring already in project. However, we have one bottleneck that this excel file can have different columns, user can change the order of columns . So, we have to identify which column has what data from first row /
Apache POI Parsing error
I know this question has been asked often, but couldn’t find a suitable solution. When working with or I always end up with the following error: People have suggested to open PackageRelationshipCollection and retry. But that didn’t help much. Also I have the jars loaded : Answer From the Apache POI FAQ: Can I mix POI jars from different versions?
File is corrupted after creating excel (.xlsx) file by using Apache POI with Java
I have created a Workbook/Excel in .xlsx format with Java using Apache POI API successfully. My code is as below that is created a file named “RiponAlWasim.xlsx” in D drive: When I tried to open “RiponAlWasim.xlsx” it was shown the file is corrupted. What’s the wrong? Answer It needs to be added at least one sheet to the workbook. So,
NoClassDefFoundError: UnsupportedFileFormatException while using apache poi to write to an excel file
I am trying to write to an excel(.xlsx) file using Apache poi, I included the apache poi dependencies in my pom.xml file. But I am getting the following exception in execution. The code and pom.xml is specified as follows. I am getting the exception in the following line. Code: Pom: Answer I think You’r missing some classes “UnsupportedFileFormatException” try to
Java apache POI java.lang.IllegalArgumentException: Position 21504 past the end of the file
I don’t know what am I doing wrong. I’m just reading and writing an Excel file, but always get this exception: java.lang.IllegalArgumentException: Position 21504 past the end of the file book.xls exists and has the number “1” in each cell from A1 to L50. Answer You are attempting to write the Workbook back to the same file pathname from which