xssf

Apache POI Excel text formatting through XSSFRichTexString and Jsoup

二次信任 提交于 2019-12-01 12:55:07
问题 I was getting the html data from database. Below is the example : <ul> <li> <strong>Iam Bold </strong> <u><span style="color:Red">Iam Red Colored and Underlined</span> </u> </li> <li> Just a Normal Text </li> <li> Iam <b> Bold </b> <i><span style="color:Green"> and italic with colored </span></i> <u> and underlined </u> </li> </ul> Now the same formatting is to be there in my excel output. Please see the below image for excel output. I know that by using Jsoup , you can parse the above html

Can't read Excel 2010 file with Apache POI. First Row number is -1

时光总嘲笑我的痴心妄想 提交于 2019-12-01 12:54:37
I am trying the this testfile with the Apache POI API (current version 3-10-FINAL). The following test code import java.io.FileInputStream; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class ExcelTest { public static void main(String[] args) throws Exception { String filename = "testfile.xlsx"; XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(filename)); XSSFSheet sheet = wb.getSheetAt(0); System.out.println(sheet.getFirstRowNum()); } } results in the first row number to be -1 (and existing rows come back as null). The test

How to get rid of “Save changes?” prompt on xlsx-files created with Apache POI XSSF

落花浮王杯 提交于 2019-12-01 11:20:20
After opening and immediately closing an xlsx-file, created with Apache POI XSSF, I get prompted to save unsaved changes. As far as i can tell, this is happening because I am using formulas within the xlsx-file. According to the javadoc, this should be bypassed by setting XSSFWorkbook.setForceFormulaRecalculation(true) However, this doesn't solve the problem. I also tried to manually recalculate the formulas before saving the file without success. SSCCE: import java.io.FileOutputStream; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import org

Can't read Excel 2010 file with Apache POI. First Row number is -1

霸气de小男生 提交于 2019-12-01 10:55:31
问题 I am trying the this testfile with the Apache POI API (current version 3-10-FINAL). The following test code import java.io.FileInputStream; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class ExcelTest { public static void main(String[] args) throws Exception { String filename = "testfile.xlsx"; XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(filename)); XSSFSheet sheet = wb.getSheetAt(0); System.out.println(sheet

How to get rid of “Save changes?” prompt on xlsx-files created with Apache POI XSSF

﹥>﹥吖頭↗ 提交于 2019-12-01 09:51:30
问题 After opening and immediately closing an xlsx-file, created with Apache POI XSSF, I get prompted to save unsaved changes. As far as i can tell, this is happening because I am using formulas within the xlsx-file. According to the javadoc, this should be bypassed by setting XSSFWorkbook.setForceFormulaRecalculation(true) However, this doesn't solve the problem. I also tried to manually recalculate the formulas before saving the file without success. SSCCE: import java.io.FileOutputStream;

How to evaluate a excel formula through XSSF event API

白昼怎懂夜的黑 提交于 2019-12-01 07:31:22
I am reading XLSX files using event API of Apache POI, i.e I read the contents of the XLSX sheet through a SAX Parser. I want to know how can we get the computed value of a formula by using XSSF event API. The way I know to do this is by using the FormulaEvaluator class. But since formulaEvaluator takes an instance of Workbook class I don't want to use this approach. (I am reading Excel files containing a million rows and 100 columns so if I create a Workbook object of that Excel my app server goes out of memory and hence I am using Event API) How can I do the evaluation in event parsing,

How to evaluate a excel formula through XSSF event API

末鹿安然 提交于 2019-12-01 04:48:08
问题 I am reading XLSX files using event API of Apache POI, i.e I read the contents of the XLSX sheet through a SAX Parser. I want to know how can we get the computed value of a formula by using XSSF event API. The way I know to do this is by using the FormulaEvaluator class. But since formulaEvaluator takes an instance of Workbook class I don't want to use this approach. (I am reading Excel files containing a million rows and 100 columns so if I create a Workbook object of that Excel my app

Apache POI, using both XSSF and HSSF

廉价感情. 提交于 2019-11-30 20:12:08
I have a problem with Apache POI project. I failed to use XSSF and HSSF in the "Same Java Class" . Which jar should I download or which artifact should I get add into maven? I want to handle both xls and xlsx files at the same time. When I get excel version error, I will change the XSSF to HSSF or HSSF to XSSF . How can I do this? Instead of doing that, try using the new release of Apache POI 3.7, it has SS package which handles both HSSF and XSSF without worrying about type Details here: http://poi.apache.org/spreadsheet/index.html Aside from the "standard" SS package solution, you can also

java实现赋值Excel模板并写入后导出

ⅰ亾dé卋堺 提交于 2019-11-30 14:43:07
package com.at21.gpd.action; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel

HSSFWorkbook vs XSSFWorkbook vs SXSSFWorkbook - Apache-poi

穿精又带淫゛_ 提交于 2019-11-30 08:54:20
HSSFWorkbook vs XSSFWorkbook and the advantages/disadvantages of XSSFWorkbook and SXSSFWorkbook ? A spreadsheet of each with as a summary of API features: Source: https://poi.apache.org/spreadsheet/ 来源: https://stackoverflow.com/questions/33047512/hssfworkbook-vs-xssfworkbook-vs-sxssfworkbook-apache-poi