apache-poi

Apache POI Excel cell formatting is not working beyond 32748 cell in a sheet

為{幸葍}努か 提交于 2019-12-23 06:14:54
问题 I have a requirement where I need to generate a report for all transaction for a given period, and I need to apply the cell format accordingly. In this case cell formatting is not working especially for Date after creating 32748 cells in the sheet. This seems to be bug in the API, please provide some inputs if anybody already faced this issue and found any fix. For reference, here is the sample code : public class TestFormat { public static void main(String args[]){ try { HSSFWorkbook wb =

ColdFusion - converting HTML webpage to Word or PDF document

扶醉桌前 提交于 2019-12-23 05:47:06
问题 I have a webpage, where user has a possible to Print this page OR to save it on his/her computer. How may I save it as a Word or PDF document? Thanks. 回答1: For the MS Word requirement, most versions of Office can interpret basic html/xml. So you might consider the old cfcontent hack as a simpler alternative to POI. (The Word package is not quite as mature as the spreadsheet package.) Basically you generate html, but use cfheader/cfcontent to tell the browser the content is really a Word

How to import both xls and xlsx files using java in spring mvc

一个人想着一个人 提交于 2019-12-23 05:29:26
问题 In this method i used xssf class which is used to read xlsx file but we cant do it for xls file.for xls we need to have Hssf class .User can import any format there .My requirement,Is there any Class that can be used instead of xssf and hssf to read both kind of file. in my example i used xssf. @RequestMapping(value="/import",method = RequestMethod.POST) public ModelAndView imports(Model model, @RequestParam("excelFile") MultipartFile excelfile){ try { List<DepartmentModel> lstUser = new

How to calculate Formulas in Excel with Apache-POI and avoid the “save changes” messagebox?

烂漫一生 提交于 2019-12-23 05:27:07
问题 I've got the following Problem: I wrote a Java programm that writes values into a xlsx file. This xlsx file calculates new values using Formulas. Now I want to get this calculated Values out of the xlsx file. The Problem is, that I don't get the calculated values into my Java programm, because changes aren't saved. So I tryed to edit the xl/workbook.xml in the xlsx file to get rid of that save changes question. That works, but now the formula cells that I try to read return a default value

Attempt to write an excel file with Apache POI causing OutOfMemoryError

前提是你 提交于 2019-12-23 05:16:34
问题 I have a program which writes an excel file. It uses Apache POI to write excel 2007 files (I have more than 256 colums so I have to use it). The program works. I've tested it out on very small files but if I use more rows it runs out of memory. Here's the stack trace : Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Unknown Source) at java.io.ByteArrayOutputStream.write(Unknown Source) at org.apache.poi.openxml4j.opc.internal

how to set page number for different section in word by poi

落花浮王杯 提交于 2019-12-23 04:43:47
问题 My document has three parts: cover, contents and text. I want to set different page number for each section. The cover does not need page numbers. The contents page numbers are in Rome numerals, and the pages in the main body are in Greek numbers. Can it be realized with POI? 回答1: Apache poi is - until now - only abel creating three types of header / footers: HeaderFooterType .DEFAULT , .EVEN and .First . So for fulfilling your requirement we need using the underlaying low level objects. And

how to split Excel file using java?

淺唱寂寞╮ 提交于 2019-12-23 04:06:07
问题 I have Excel sheet with 200000 rows.i want to splits the excel file for each 50000 Records. i am using Apache POI API To read and write Excel file.Is it possible to split file if number of row reaches on defined Record size.please help me to get the solution for that problem. Code: public String[][] getSheetData(int SheetIndex) { int noOfColumns = 0;XSSFRow row = null; XSSFCell cell = null; int i=0;int noOfRows=0; int j=0; String[][] data=null; XSSFSheet sheet=null; try { loadFile(); //load

how to move the active cell to the top left cell in the range apache poi using XSSFWorkbook?

时间秒杀一切 提交于 2019-12-23 03:51:59
问题 I am trying to migrate the java excel code from JBook to XSSFWorkbook. Am not getting exact methods that are used in JBook. Some of them are: JBook.setSelection(int row, int col, int row, int col); JBook.setSelection(JBook.getDefinedName("some String")); The first method explains moving the active cell to the top left cell in the range. Is there any way to get the rowindex and column index from XSSFWorkbook object? 回答1: You can't set active cell via workbook object. Possible options: if you

How to create a bulleted list in Apache POI XWPF Document?

邮差的信 提交于 2019-12-23 03:13:03
问题 I want to create a bulleted/numbered list in a docx word document with Java. I am using the Apache POI 3.10 library. If I understand correctly, the steps would be like this: Create Numbering numbering = doc.createNumbering add AbstractNum to the Numbering and get the corresponding abstractNumId Add a Num with the AbstractNumId numId = numbering.addNum(abstractNumId) Now I can add numId to the paragraphs using para.setNumID(numId) ; However I am stuck in the second step. How do I create an

Date format issue with POI XSSF and SAX (Event API)

孤街醉人 提交于 2019-12-23 02:56:06
问题 I am using POI's Event API to process large volume of records without any memory foot print issues. Here is the refernce for it. When i processing XLSX sheet, i am getting different format of Date value than specified format in excel sheet. Date format for a column in excel sheet is 'dd-mm-yyyy' where as I am getting the value in 'mm/dd/yy' format. Can some one tell me how to get the actual format given in excel sheet. Reference of code snippet is given below. ContentHandler handler = new