apache-poi

Writing to a existing xls file using POI

眉间皱痕 提交于 2019-12-08 01:39:03
问题 The scenario is roughly this: I have a java program with several methods getting called randomly. The first method will create an xls file using apache POI and will put the headers for the columns. All the other methods has to write a record into this file. The final method will first mail the created xls and then delete the xls. For above scenario is the below approach correct: 1) Create the file and put the header names in the first method: Workbook wb = new HSSFWorkbook(); CreationHelper

How to write data in multiple cells in Excel using java?

痞子三分冷 提交于 2019-12-08 00:57:23
问题 I wrote a code for writing data in an Excel sheet.In this i have to write the data in multiple cells.But it is showing some Errors.For one cell it is able to change the data.I kept for loop for changing the data in multiple cells.For this it is showing Error. Can any one tell me that where i did mistake. import java.io.*; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Iterator; import java.util.List; import java.util.Vector; import java.lang.String; import

How to Un-Hide a hidden row in Excel using Apache Poi in Java?

ε祈祈猫儿з 提交于 2019-12-08 00:44:45
问题 I have: import org.apache.poi.ss.usermodel.Row; if ((currentRow = sheet.getRow(currentDataRow)) == null) { currentRow = sheet.createRow(currentDataRow); // Creates a new row. } // How to un-hide currentRow ? currentRow is hidden, so to un-hide this row using this currentRow object? Please help.. !! 回答1: Looks like it's getRowStyle().setHidden(): currentRow.getRowStyle().setHidden(false); More info on getRowStyle. 回答2: I had poi-3.7 and these methods didn't show up either. Downloaded the

java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook

心已入冬 提交于 2019-12-07 21:03:01
问题 java.lang.NoClassDefFoundError:org/apache/poi/hssf/usermodel/HSSFWorkbook This is java web project. The java project is ok, but in web, I got this exception. Caused by: java.lang.ClassNotFoundException: org.apache.poi.hssf.usermodel.HSSFWorkbook at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) maven dependency : <!-- apahce poi --> <dependency> <groupId>org.apache.poi<

Apache POI-HSSF vs POI-XSSF

ぐ巨炮叔叔 提交于 2019-12-07 20:47:07
问题 HSSF is the POI Project's pure Java implementation of the Excel '97(-2007) file format. XSSF is the POI Project's pure Java implementation of the Excel 2007 OOXML (.xlsx) file format. Are there any export limitations when using HSSF? I've once read somewhere that Excel '97 just supported <65.000 Entries . Is it safe to use HSSF to export excel sheets with more than 65.000 Entries, or why would I use XSSF? 回答1: As you can see here Excel 97 to 2003 supports a maximum of 65,536 rows. So no, with

how to set watermark image at background in excel using poi

房东的猫 提交于 2019-12-07 20:43:18
问题 i am using the following code to set water mark in the excel sheet, i also get the water mark but instead of showing the watermark at the back round it shows the water mark at foreground. how to resolve this, the code : //to add water mark HSSFPatriarch dp = sheet.createDrawingPatriarch(); HSSFClientAnchor anchor = new HSSFClientAnchor (0, 0, 1023, 255, (short) 2, 4, (short) 13, 26); HSSFTextbox txtbox = dp.createTextbox(anchor); HSSFRichTextString rtxt = new HSSFRichTextString("POC");

How to insert a table in ms excel using apache java poi

江枫思渺然 提交于 2019-12-07 20:38:45
问题 I am trying to insert a table in Excel using Java Apache Poi. But when I am opening the xlsx file it is throwing the following error and I could not solve it: Removed Part: /xl/tables/table1.xml part with XML error. (Table) Load error. Line 2 repaired records: table from /xl/tables/table1.xml part (table) My code is the following: import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache

How can one programmatically read the graph values from a Powerpoint presentation using Apache's POI?

坚强是说给别人听的谎言 提交于 2019-12-07 19:32:54
问题 I have a Powerpoint presentation with an graph which I want to access using Java and Apache's POI. When I edit the graph data using Powerpoint an Excel window opens with the values, I want to access these values from my Java application. How does one access the values of the graph programmatically? 回答1: In the first part we need to navigate to an XSLFChart object: final String filename = "resources/fptbenchmark/Powerpoint Import.pptx"; final XMLSlideShow ppt = new XMLSlideShow(new

Apache poi file getting corrupted and unable to write to existing workbook

荒凉一梦 提交于 2019-12-07 19:07:38
问题 I am trying to write to read and write to a workbook using the following code: public static void main(String args[]) { String absoluteFilePath = System.getProperty("user.dir") + File.separator + "abc.xlsx"; System.out.println("Readin file : " + absoluteFilePath); Workbook workbook = null; try { workbook = WorkbookFactory.create(new File(absoluteFilePath)); //reading and writing on sheets of workbook } } catch (Exception e) { e.printStackTrace(); } finally { try { System.out.println("Writing

how change text direction(not paragraph alignment) in document in apache poi word?(XWPF)

十年热恋 提交于 2019-12-07 18:53:38
问题 I'm trying to use Apache poi word 3.8 to create word document in persian/arabic language. My question is: how change text direction in document? ( it means changing text direction not changing just paragraph text alignment) In MS Word we could use Right-to-left text direction to change text direction and Align Right to set alignment. What’s equivalent of the first one in poi set property? 回答1: This is bidirectional text direction support (bidi) and is not yet implemented in apache poi per