Tag: eclipse

使用Apache POI从Excel中读取由一系列合并单元格索引的多行

我正在尝试使用Apache POI读取Excel文件。 我的问题是试图读取一系列的行作为一个合并单元格,考虑到这个合并包含的行数是任意的。 这张照片 可能是一个适当的例子,我希望。 在这种情况下,我不能拿出一个函数来通过属性的所有行,并停止当我到达外键行。 合并单元格中的“属性”string包含在合并单元格的第一行中。 谢谢您的帮助!

在android项目中写入excel文件与apache poi

我有问题让我的项目工作,我会粘贴的Java文件和错误日志希望有人可以给我一个提示。 单击R.id.bskickaTidSc3中的buttonR.id.bskickaTidSc3时,应用程序崩溃。 错误日志 06-08 12:45:49.365: E/dalvikvm(1243): Could not find class 'org.apache.poi.hssf.usermodel.HSSFWorkbook', referenced from method com.example.spapp_beta.TidsedelExcel.SetExcelVecka 06-08 12:45:49.365: W/dalvikvm(1243): VFY: unable to resolve new-instance 67 (Lorg/apache/poi/hssf/usermodel/HSSFWorkbook;) in Lcom/example/spapp_beta/TidsedelExcel; 06-08 12:45:49.365: D/dalvikvm(1243): VFY: replacing opcode 0x22 at 0x0000 06-08 12:45:49.365: D/dalvikvm(1243): DexOpt: unable to opt direct call 0x0087 at 0x09 in Lcom/example/spapp_beta/TidsedelExcel;.SetExcelVecka 06-08 12:45:49.375: D/AndroidRuntime(1243): Shutting down […]

JExcel API中的Workbook.getWorkbook()错误

我正在使用JExcel API读取Eclipse中的.xls文件。 这是我的代码: import jxl.*; import java.io.File; public class JExcelDemoClass { public static void main(String[] args) { try { Workbook wrk1=new Workbook.getWorkbook("C:\\Test.xls"); Sheet sheet1=wrk1.getSheet(0); Cell col1row1=sheet1.getCell(0,0); Cell col1row2=sheet1.getCell(0,1); Cell col1row3=sheet1.getCell(0,2); String get_col1row1=col1row1.getContents(); String get_col1row2=col1row2.getContents(); String get_col1row3=col1row3.getContents(); System.out.println(get_col1row1); System.out.println(get_col1row2); System.out.println(get_col1row3); } catch(Exception e) { System.out.println("Error"); } } } 当我尝试运行这个代码时,Eclipse给了我错误 Workbook.getWorkbook无法parsing为types 任何想法,为什么我得到这个错误?

GWT:我如何读取包含在我的src文件夹中的Excel文件?

我正在尝试在GWT中编程(使用Eclipse和GWTdevise器)。 我希望能够将我已经导入到源文件夹中的Excel文件,读取并处理数据。 数据将是文本和数字,但我很乐意从string转换为其他types。 我已经看到了关于RequestBuilder的一些东西,但我不知道如何使用它来读取Excel。 或者,有没有更好的方法来做到这一点? 我愿意把Excel文件转换成类似CSV的文件,这是必要的。

类的实例引起nullPointerException

我正在Eclipse中导入一个带poi的Excel 2007文件。 我的问题是一个NullPointerException ,但我不知道如何找出它来自哪里。 可能是类Data的实例有问题。 这是代码: import java.io.*; import java.io.*; import java.util.ArrayList; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.WorkbookFactory; import org.apache.poi.ss.usermodel.Workbook; import org.apache.xmlbeans.XmlOptions; class Data{ public Data(){}; public Data(double[] codnt, int ctgr1, int ctgr2) { // super(); this.codnt = codnt; this.ctgr1 = ctgr1; this.ctgr2 = ctgr2; } double codnt[]; int […]

POI无法打开工作簿来打开.xls文件和eclipse抛出exception

当我尝试在POI中打开一个.xlsx文件时,出现exception: java.lang.IllegalArgumentException: The supplied POIFSFileSystem does not contain a BIFF8 'Workbook' entry. Is it really an excel file? at org.apache.poi.hssf.usermodel.HSSFWorkbook.getWorkbookDirEntryName(HSSFWorkbook.java:223) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:245) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:188) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:170) InputStream input = new BufferedInputStream( new FileInputStream(fileName)); POIFSFileSystem file = new POIFSFileSystem( input ); //Create Workbook instance holding reference to .xls file HSSFWorkbook wb = new HSSFWorkbook(file); //Get first/desired […]

如何将输出写入到robotium的Excel中?

我已经使用POI将输出写入Excel。 我的代码在一个正常的Android应用程序中完美工作。 但是当我运行应用程序作为Android J单位写入Excelfunction不起作用。这里是我在robotiumtesting项目中使用的条件 if (solo.getButton("Submit").isShown()){ new TestResult().resultToExcel("/mnt/sdcard/Test_output.xls",0, "TC_memory1", "passed","testcase passed",6); } else { new TestResult().resultToExcel("/mnt/sdcard/Test_output.xls",0, "TC_memory1", "failed","testcase failed",6); } 任何人都可以提出一个方法来使用robotium将输出写入excel文件。

如何使用Apache POI获取MS Excel单元格的名称和内容

我有这个Excel表格,用户input关于几何形状的信息。 正如你所看到的单元格C:3已经被命名为“形状”,值是三angular形。 代码的第一部分可以拉出单元格的名称,下面的块可以打印特定单元格或范围内的值。 我希望能够传递第一个代码的名字,而不是硬编码到String cname中。 换句话说,string的名称应该等于我的第一个循环拉的所有值,也许一个嵌套循环? 公共类RangeSetter { public static void main(String[] args) throws IOException { // File Location FileInputStream file = new FileInputStream(new File("test2.xls")); HSSFWorkbook wb = new HSSFWorkbook(file); // retrieve workbook // This part of the code pulls all the names of the cells int NameTotalNumber = wb.getNumberOfNames(); for (int NameIndex = 0; […]

在Selenium Java中从Excel文件读取数据

我正在尝试从Excel工作表中读取数据以自动执行我的testing(使用许多login凭证)。 我正在使用我在网上find的实用程序。 但它没有成功运行。 这是实用程序 package google; import java.io.File; import java.io.IOException; import java.util.Hashtable; import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; public class class2 { static Sheet wrksheet; static Workbook wrkbook =null; static Hashtable dict= new Hashtable(); //Create a Constructor public class2(String ExcelSheetPath) throws BiffException, IOException { //Initialize wrkbook = Workbook.getWorkbook(new File(ExcelSheetPath)); //For Demo purpose the […]

eclipse插件抛出org.eclipse.e4.core.di.InjectionException:java.lang.NoClassDefFoundError:org / apache / poi / ss / usermodel / Row

我正在尝试使用包含文本字段的eclipse插件的值填充Excel表。 我正在使用java获取下面提供的exception日志 添加的jar子是dom4j-1.6,poi-3.7-20101029,poi-ooxml-3.7,poi-ooxml-schemas-3.7-20101029,xmlbeans-2.3.0 另外,我还在MANIFEST.MF中添加了条目类path:/poi-3.7-20101029.jar org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Row at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.j`enter code here`ava:243) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132) at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:850) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:743) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:727) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:662) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) […]