poi

Apache POI - How to register a function

匿名 (未验证) 提交于 2019-12-03 10:10:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I read the tutorial on the website of Apache POI on how to register custom functions into a FormulaEvaluator and I wanted to use it to define the function MINVERSE for which POI does not provide support. So, first off I created a class that defines MINVERSE (For testing purposes only, I defined MINVERSE to return always the value 10). So here is MINVERSE.java: package simpleboxapi; import org.apache.poi.ss.formula.OperationEvaluationContext; import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.ValueEval;

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

匿名 (未验证) 提交于 2019-12-03 09:14:57
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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 to workbook and Closing the file");

Apache POI使用详解

一笑奈何 提交于 2019-12-03 09:09:48
1.POI结构与常用类 (1)POI介绍 Apache POI是Apache软件基金会的开源项目,POI提供API给Java程序对Microsoft Office格式档案读和写的功能。 .NET的开发人员则可以利用NPOI (POI for .NET) 来存取 Microsoft Office文档的功能。 (2)POI结构说明 包名称 说明 HSSF 提供读写Microsoft Excel XLS格式档案的功能。 XSSF 提供读写Microsoft Excel OOXML XLSX格式档案的功能。 HWPF 提供读写Microsoft Word DOC格式档案的功能。 HSLF 提供读写Microsoft PowerPoint格式档案的功能。 HDGF 提供读Microsoft Visio格式档案的功能。 HPBF 提供读Microsoft Publisher格式档案的功能。 HSMF 提供读Microsoft Outlook格式档案的功能。 (3)POI常用类说明 类名 说明 HSSFWorkbook Excel的文档对象 HSSFSheet Excel的表单 HSSFRow Excel的行 HSSFCell Excel的格子单元 HSSFFont Excel字体 HSSFDataFormat 格子单元的日期格式 HSSFHeader Excel文档Sheet的页眉

Apache POI: Exception while calculating formulae

匿名 (未验证) 提交于 2019-12-03 09:06:55
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have gone through many questions posted here and referred POI documentation too, but i am not able to resolve this issue. Issue: When trying to re-calculate the formula i am getting an exception. Formula: =CONCATENATE("#DFLT=",COUNTIF(C5:C390,"=DEFAULTERS"),"; #NP=",COUNTIF(C5:C390,"=NOT PAID"),"; #PCsh=",COUNTIF(C5:C390,"=Paid Cash"),"; #PChk=",COUNTIF(C5:C390,"=Paid Cheque"),"; #PNeft=",COUNTIF(C5:C390,"=Paid Neft")) Exception: 10-22 17:13:15.177: E/AndroidRuntime(26300): FATAL EXCEPTION: main 10-22 17:13:15.177: E/AndroidRuntime(26300):

What is the real difference between Pointers and References?

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: AKA - What's this obsession with pointers? Having only really used modern, object oriented languages like ActionScript, Java and C#, I don't really understand the importance of pointers and what you use them for. What am I missing out on here? 回答1: It's all just indirection: The ability to not deal with data, but say "I'll direct you to some data, over there". You have the same concept in Java and C#, but only in reference format. The key differences are that references are effectively immutable signposts - they always point to something.

spark-submit yarn-cluster with --jars does not work?

匿名 (未验证) 提交于 2019-12-03 08:59:04
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to submit a spark job to the CDH yarn cluster via the following commands I have tried several combinations and it all does not work... I now have all the poi jars located in both my local /root, as well as HDFS /user/root/lib, hence I have tried the following spark-submit --master yarn-cluster --class "ReadExcelSC" ./excel_sc.jar --jars /root/poi-3.12.jars, /root/poi-ooxml-3.12.jar, /root/poi-ooxml-schemas-3.12.jar spark-submit --master yarn-cluster --class "ReadExcelSC" ./excel_sc.jar --jars file:/root/poi-3.12.jars, file:/root

POI Excel Merging Causing “Repaired Records: Format from /xl/styles.xml part (Styles)”

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have merged two excel files using the code specied here http://www.coderanch.com/t/614715/Web-Services/java/merge-excel-files this the block applying the styles for my merging cells if (styleMap != null) { if (oldCell.getSheet().getWorkbook() == newCell.getSheet().getWorkbook()) { newCell.setCellStyle(oldCell.getCellStyle()); } else { int stHashCode = oldCell.getCellStyle().hashCode(); XSSFCellStyle newCellStyle = styleMap.get(stHashCode); if (newCellStyle == null) { newCellStyle = newCell.getSheet().getWorkbook().createCellStyle();

Apache POI autoSizeColumn() not working right [duplicate]

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: Apache POI autoSizeColumn Resizes Incorrectly 8 answers I am creating a program that writes information to an excel file using the apache poi. After I enter all of my data into the file I call the autoSizeColumn method on every column of the file. But it resizes the columns to the width of the last cell entered which is sometime not as big as the other cells in the column. I know I'm using it right and unfortunately I don't have Internet right now to post any code but I will update when I can. Ok I

POI - How do I set cell value to Date and apply default Excel date format?

匿名 (未验证) 提交于 2019-12-03 08:41:19
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I've been using Apache POI for some time to read existing Excel 2003 files programmatically. Now I have a new requirement to create entire .xls files in-memory (still using Apache POI) and then write them to a file at the end. The only problem standing in my way is the handling of cells with dates. Consider the following code: Date myDate = new Date (); HSSFCell myCell ; // code that assigns a cell from an HSSFSheet to 'myCell' would go here... myCell . setCellValue ( myDate ); When I write the workbook containing this cell out to

Apache POI error loading XSSFWorkbook class

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to write a program that works with Excel docs, but the HSSF format is too small for my requirements. I'm attempting to move to XSSF, but I keep getting errors when trying to use it. I managed to solve the first two by adding xmlbeans-2.3.0.jar and dom4j-1.6.jar to my program, but now this error is coming up, which doesn't seem to be resolved by adding the Apache commons jar available on the Apache website. The error is as follows: Exception in thread "main" java . lang . NoClassDefFoundError : org / apache / commons /