apache-poi

How to remove warning in Excel using apache poi in JAVA?

落花浮王杯 提交于 2019-12-10 02:04:08
问题 I am using apache poi api to generate Excel sheet in my application in java. Data that are set in excel are coming dynamically with type string. For column1, values are alphanumeric . When I generate Excel, it will give me green indication with warning "Number Stored as Text" or "Text date with 2-digit year" on cell. I want to remove that warning. I found that from excel we can flag a cell as 'ignore error', to ignore the warning. How to do it programmatically or is there any other

Excel Formula Not Updating Cell

寵の児 提交于 2019-12-10 01:50:30
问题 I am using apache POI to change cells in an excel sheet. After I change the values, the cells with formulas corresponding to cells that have been changed are not updating. When I go into excel and click on the cell with the formula, and then click in the function bar, the formula updates. I have calculation options set to automatically update. Quick example. Row : [A2 + A3] [1] [2] A1 here would equal 3 When I change it using POI: [A2+A3] [2] [5] A1 still equals 3 until I click on that cell.

How can I get an Input Stream from HSSFWorkbook Object

匆匆过客 提交于 2019-12-10 01:45:44
问题 I want my web application users to download some data as an Excel file. I have the next function to send an Input Stream in the response object. public static void sendFile(InputStream is, HttpServletResponse response) throws IOException { BufferedInputStream in = null; try { int count; byte[] buffer = new byte[BUFFER_SIZE]; in = new BufferedInputStream(is); ServletOutputStream out = response.getOutputStream(); while(-1 != (count = in.read(buffer))) out.write(buffer, 0, count); out.flush(); }

POI 4 XPages installation (site.xml)

大憨熊 提交于 2019-12-10 00:50:16
问题 I find this website (http://poi4xpages.openntf.org/) for install POI 4 in domino designer. I download the zip file and follow the installation guide from https://my.webgate.biz/poi/documentation.nsf/viewdoc.xsp?docid=installguide In step 2: Import the update site from the ZIP file into the eclipse update site. I try to import the site.xml file but I get an error. The error is like this: Object variable not set(#91) dlgimportsite: click (line 9) I open site.xml and check line 9, the code is

Apache POI - Invalid part to process data

China☆狼群 提交于 2019-12-10 00:30:43
问题 I access an Excel spreadsheet using Java Apache POI ( hssf ). I got the following error : java.lang.RuntimeException: org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF) at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:143) at org

Java - POI - Add a picture to the header

南笙酒味 提交于 2019-12-10 00:26:36
问题 I have been trying to add a picture to a new docx file using Java POI to the header. 1) I have added a header, and added a text to it (using XWPFHeaderFooterPolicy). 2) I have create an image (using CustomXWPFDocument). 3) But I could not insert the image inside the header area. I have tried to do so through adding the picture into the same paragraph of the header, but it did not work. Here is the function that should add the picture to the header. It takes a CustomXWPFDocument object that

How to use Tika's XWPFWordExtractorDecorator class?

◇◆丶佛笑我妖孽 提交于 2019-12-09 23:37:01
问题 Someone told me that Tika's XWPFWordExtractorDecorator class is used to convert docx into html. But I am not sure how to use this class to get the HTML from docx. Any other library for doing the same job is also appreciated/ 回答1: You shouldn't use it directly Instead, call Tika in the usual way, and it'll call the appropriate code for you If you want XHTML from parsing a file, the code looks something like // Either of these will work, the latter is recommended //InputStream input = new

How to move position of chart in excel by Java POI

孤者浪人 提交于 2019-12-09 23:25:36
问题 I want to add row in excel by java POI and I try with both shiftRows() function and createRow() function both function can add row in excel but below chart position is remain and not move I also like to move (shift down) the position of chart I use poi version 3.9 Can anyone give me the advice or idea to move the position of that chart image As the fact, the data range of chart also not changed. I need not only to move the position of charts but also need to increase the data range of chart

Error reading Excel .XLSX with Apache POI

自古美人都是妖i 提交于 2019-12-09 17:21:13
问题 I am using Apache POI 3.8 libraries to read an XLSX file in a web application. The following code works perfectly fine from a Java console app: InputStream inputFS = new FileInputStream("test.xlsx"); Workbook workbook = new XSSFWorkbook(inputFS); // below exception is thrown on this line Sheet sheet = workbook.getSheetAt(0); but throws a "read error" when used in the web application. A relevant extract of the stack trace is pasted below: java.io.IOException: Read error at java.io

XSSF (POI) - Adding “formula” column to pivot table

孤街醉人 提交于 2019-12-09 16:50:42
问题 I am using POI 3.12-beta1: <!-- Apache POI (for Excel) --> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.12-beta1</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.12-beta1</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>ooxml-schemas</artifactId> <version>1.1</version> </dependency> I am trying to create a calculated pivot table column which is