草庐IT

poi-ooxml

全部标签

java - Apache POI 表 `index` 中的参数 `getMergedRegion` 是什么意思?

index在getMergedRegion中是什么意思?Apache的HSSFSheetdocumentation没有明确描述index参数的含义。 最佳答案 来自可在此处下载的免费资源http://poi.apache.org/download.html我们有.../***@returnthemergedregionatthespecifiedindex*/publicCellRangeAddressgetMergedRegion(intindex){return_sheet.getMergedRegionAt(index);}当

java - POI Excel 合并导致 "Repaired Records: Format from/xl/styles.xml part (Styles)"

我已经使用此处指定的代码合并了两个excel文件http://www.coderanch.com/t/614715/Web-Services/java/merge-excel-files这是为我的合并单元格应用样式的blockif(styleMap!=null){if(oldCell.getSheet().getWorkbook()==newCell.getSheet().getWorkbook()){newCell.setCellStyle(oldCell.getCellStyle());}else{intstHashCode=oldCell.getCellStyle().hashC

java - 使用 apache poi 读取 xlsx 时主线程中出现 NoSuchMethodError

我的代码是[...]importorg.apache.poi.poifs.filesystem.POIFSFileSystem;importorg.apache.poi.ss.usermodel.Workbook;importorg.apache.poi.xssf.usermodel.XSSFSheet;importorg.apache.poi.xssf.usermodel.XSSFWorkbook;importorg.apache.poi.hssf.usermodel.HSSFCell;importorg.apache.poi.hssf.usermodel.HSSFSheet;imp

java - Apache poi : saving jtable to a file

我最近开始使用java,当我需要从jTable创建一个excel文件时,我遇到了apachepoi库的一些问题。我已经阅读了很多线程并提出了一些行不通的代码(即使这是非常简单的东西并且有很多示例,这让我看起来更加愚蠢)并且我希望有人可以提供帮助我出去。下面是问题:a)为什么应该写入excel文件的for循环没有填满每个单元格?(excel文件中唯一有数据的行是第六行,这也让我想知道为什么它计算getRowCount/Column方法的表模型中的空项。我也知道它打印的是自定义字符串而不是表本身,但将其保存到点b)b)我应该如何使用jtable模型项来填充excel文件,因为在创建表时我必

java - POI 在从 excel 读取数字数据时追加 .0

我正在使用POIHSSF读取excel数据,我正在使用JUnit根据数据库procRefCursor检查数据。Junit测试失败,因为将来自Refcursor的数字数据(例如100)与Excel工作表100中的数据进行比较,但由于POI将其读取为100.0而失败。InputStreamfileInputStream=Testdb.class.getClassLoader().getResourceAsStream(fileName);//retrievenumberofcolumnsandrowsintnumRows=0,numCols=0,i,j,minColIndex=0,maxC

java - 保存 Excel 文档 Apache POI

我需要从Excel文档创建通知,我使用的是Java和ApachePOI。这是我的代码://GetpathwithJFileChooserpublicstaticStringLeeRuta(){JFileChooserchooser=newJFileChooser();chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);chooser.showDialog(chooser,"Seleccionar");Filef=chooser.getSelectedFile();Filecamino=f.getAbsolut

java - Apache POI : API to identify tables in the excel sheet and read them

是否有任何方法可以返回工作表中存在的表格列表?我的要求是从工作表上存在的多个表中获取数据。 最佳答案 假设您正在为.xlsxexcel文件使用XSSFAPI。如果表格是由Insert->Table创建的,那么您可以使用以下命令读取它们:XSSFWorkbookworkbook=newXSSFWorkbook(newFile("test.xlsx"));intnumberOfSheets=workbook.getNumberOfSheets();for(intsheetIdx=0;sheetIdxtables=sheet.getTab

java - 从单元格值获取单元格索引,Apache POI

EnvironmentStatusVersionPatchNumberWindowsLive1.02UnixLive2.04MacLive1.38如果我在excel中有上面显示的数据,我如何使用文本访问PatchNumber的cellNumberXSSFRowrow=(XSSFRow)rows.next();我想访问row.getCellNumber("PatchNumber");//注意这个方法在ApachePOI中不存在。 最佳答案 我想我明白您的意思-您想知道哪一列的第一行包含单词“Patch”?如果是这样,您需要做的就是:S

java.lang.ClassNotFoundException : org. apache.poi.xssf.usermodel.XSSFWorkbook

当我尝试在正常的java类中创建一个工作簿时,它正在创建,但是当我尝试在servlet上运行它时,它抛出异常普通java类importjava.io.File;importjava.io.FileInputStream;importjava.io.FileNotFoundException;importjava.io.IOException;importorg.apache.poi.ss.usermodel.Workbook;importorg.apache.poi.xssf.usermodel.XSSFWorkbook;publicclassSampleclass{publicsta

java - 使用 Apache POI 将列标签插入数据透视表?

我使用ApachePOI3.11创建了一个数据透视表。像这样:FileInputStreamfile=newFileInputStream(newFile(path+fname));XSSFWorkbookworkbook=newXSSFWorkbook(file);XSSFSheetsheet=workbook.getSheetAt(0);//areaofpivotdataAreaReferencea=newAreaReference("A1:J4");CellReferenceb=newCellReference("N5");XSSFPivotTablepivotTable=she