apache-poi

I need to write a pass fail in excel at a specified column using POI

岁酱吖の 提交于 2020-01-06 08:49:07
问题 Ok - so I realized that after writing some code and figuring out stuff, that jxl does not support xlsx, only POI (XSSF). Ok fine. What I am trying to do is search for a cell with a string value "Result" in a specified column. Once I find that, then as a test passes or fails, it writes "Pass" or "Fail" in the cell that is blank. And it will continue to do that until the test set has finished. Here is the code I wrote using jxl. WritableWorkbook wb = Workbook.createWorkbook(new File(testData),

reading images and data from excel file using poi

做~自己de王妃 提交于 2020-01-06 08:17:36
问题 i know how to read data from excel xls/xlxs. now my requirement is that i have to read image and data from excel file using POI 3.8. can you please guide me how to do that. reading images and data both from one excel file using poi.... Thanks in advance 回答1: Straight from the developer's guide: List lst = workbook.getAllPictures(); for (Iterator it = lst.iterator(); it.hasNext(); ) { PictureData pict = (PictureData)it.next(); String ext = pict.suggestFileExtension(); byte[] data = pict

How to add custom fonts in Apache POI ppt

守給你的承諾、 提交于 2020-01-06 07:14:10
问题 I am able to add fonts which are default in Apache POI ppt but not able to add custom fonts. This is what I currently have: XSLFTextBox categoryTitleShape = indexslide.createTextBox(); categoryTitleShape.setAnchor(new java.awt.Rectangle(25, 40, 120, 30)); XSLFTextRun categoryTitle = categoryTitleShape.addNewTextParagraph().addNewTextRun(); categoryTitle.setText("CATEGORIES"); // visible text categoryTitle.setFontSize(20.); categoryTitle.setFontColor(Color.BLACK); categoryTitle.setBold(true);

Conditional formatting using in Excel using APACHE POI

折月煮酒 提交于 2020-01-06 07:00:02
问题 I have a problem using the SheetConditionalFormatting, just for testing if the cell contains particular string (in my case just "test") I run the following code: SheetConditionalFormatting sheetConditionalFormatting = excelSheet.getSheetConditionalFormatting(); ConditionalFormattingRule rule = sheetConditionalFormatting.createConditionalFormattingRule(ComparisonOperator.EQUAL, "test"); PatternFormatting fill1 = rule.createPatternFormatting(); fill1.setFillBackgroundColor(IndexedColors.BLUE

Conditional formatting using in Excel using APACHE POI

瘦欲@ 提交于 2020-01-06 06:59:25
问题 I have a problem using the SheetConditionalFormatting, just for testing if the cell contains particular string (in my case just "test") I run the following code: SheetConditionalFormatting sheetConditionalFormatting = excelSheet.getSheetConditionalFormatting(); ConditionalFormattingRule rule = sheetConditionalFormatting.createConditionalFormattingRule(ComparisonOperator.EQUAL, "test"); PatternFormatting fill1 = rule.createPatternFormatting(); fill1.setFillBackgroundColor(IndexedColors.BLUE

how to write dynamic excel file (number of column can exceed) into java objects using apache poi

时光怂恿深爱的人放手 提交于 2020-01-06 05:07:31
问题 I understand that we can create model class whose each instance variable will be bound to each excel column like below class emp{ String name; String empId; //getter and setter method of each } excel file: name | empid abc | 123 bcd | 3232 xyz | ee32 how to handle this case when number of column in excel increases dynamically 回答1: I would doing this using a kind of table model. A ExcelTableModel similar to the javax.swing.table.DefaultTableModel. Complete example showing a blueprint of this

Count pages/lines in a word file that was edited with docx4j

喜欢而已 提交于 2020-01-06 04:45:05
问题 I found some posts here how to count pages/lines with the apache-poi library. But my code already uses docx4j right now, it would be too much work to completely replace that. Therefore my question is, how can I get from an object of type WordprocessingMLPackage to an object of type XWPFDocument in order to count the lines and pages of my current document. private XWPFDocument convertDocx4J(WordprocessingMLPackage wp) { XWPFDocument oiDoc = null; //TODO... return oiDoc; } 回答1: Easiest way to

Save the data to table and save it to database even if empty rows in EXCEL java POI Apache

时间秒杀一切 提交于 2020-01-06 04:31:22
问题 I dont know how to save the content in database, I try to import the excel it works but if the excel one of the rows are empty it appears java.lang.IndexOutOfBoundsException -- Here's my code -- -- BranchEntity.java -- public class Branch { private static final long serialVersionUID = 1L; @Column(name = "branch_code", nullable = false, length = 10) private String branchCode; @Column(name = "branch_desc", nullable = false, length = 100) private String branchDescription; @OneToMany(mappedBy =

Changing date and time format (ISO 8601) of excel file in core.xml

爷,独闯天下 提交于 2020-01-06 02:47:10
问题 I am trying to open a .xlsx file using Apache POI. The data format is defined as 2016-04-05T07:13:50+03:00 in /docProps/core.xml . Unfortunately Apache POI does only accept the following format: 2016-04-05T07:13:50Z . How do I change this programmatically in Java? 回答1: POI is able to parse Date format 2016-04-05T07:13:50+03:00 in version 3.16 so you don't have to change it programatically 来源: https://stackoverflow.com/questions/36532973/changing-date-and-time-format-iso-8601-of-excel-file-in

POI 3.17 creating Cell Comments in a cloned sheet creates inconsistent xlsx

拥有回忆 提交于 2020-01-05 12:56:44
问题 I used the cloneSheet method to copy a sheet within the same workbook which already contains comments. Afterwards new comments where added to this new sheet and the excel saved. When openening the file with Excel 365, it complained about /xl/comments1.xml and recovered the file. The newly created comments are available. The comments from the clone are removed during the recovery. Opening the zip file and looking at the /xl/comments1.xml , it shows a difference. Is this an issue with the