Tag: android

Android中的JXL库

目前我正在尝试在Android中使用Jxl lib从SD卡读取数据并获取FilenotfoudException。 我用stackoverflowsearch解决scheme,并find一些。 但他们似乎没有为我工作。 我有以下代码实现:/ 代码部分 / File sdcard = Environment.getExternalStorageDirectory(); //Get the text file File Excelfile = new File(sdcard,"ExcelTest.xls"); // try { Workbook wrkbk = Workbook.getWorkbook(Excelfile); Sheet sheet1 = wrkbk.getSheet(0); //Obtain reference to the Cell using getCell(int col, int row) method of sheet Cell colArow1 = sheet1.getCell(0, 0); Cell colBrow1 = sheet1.getCell(1, 0); Cell […]

从一个Android应用程序使用Excel作为数据库

我想创build一个使用Microsoft Excel作为数据库的Android应用程序。 在应用程序,我会给更新一个Excel文件的input。 我如何继续?

在Android中使用Apache POI时的兼容性问题

我在使用Apache POI时遇到以下问题 Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' finished with non-zero exit value 2 我在我的gradle依赖项中添加了下面的仓库。 dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1' compile 'org.apache.poi:poi:3.14-beta1' compile 'org.apache.poi:poi-ooxml:3.14-beta1' } 我也testing了从poi版本3.9 。 但每次我都遇到同样的问题。 如果我评论 compile 'org.apache.poi:poi-ooxml:3.14-beta1' 应用程序无任何例外地运行 任何帮助解决这个问题将不胜感激。

Android + POI Excel +在现有文件中添加数据

我想附加在现有的Excel文件中的数据,但没有写入。 我究竟做错了什么? public static void writeSheet(String data) { HSSFWorkbook workbook; try { String outFileName = "filebook.xls"; File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM); File outFile = new File(path, outFileName); workbook = (HSSFWorkbook) WorkbookFactory.create(outFile); Row row = workbook.getSheetAt(0).createRow(0); Cell cell = row.createCell(0); cell.setCellValue("text"); OutputStream outputStream = new FileOutputStream(outFile,true); workbook.write(outputStream); outputStream.close(); workbook.close(); } catch (Exception e) { e.printStackTrace(); } }

在Android中从Excel导入数据需要帮助?

我已经使用JExcel API从Excel导入数据,对于使用JExcel,我写了下面的程序: public class ReadExcel { private String inputFile; public void setInputFile(String inputFile) { this.inputFile = inputFile; } public void read() throws IOException { File inputWorkbook = new File(inputFile); File parent_dir = inputWorkbook.getParentFile(); Workbook w; try { System.out.println("Parent dir"+parent_dir); if(parent_dir.exists() == true){ System.out.println("Pardent_dir failed"+"1"); } else { System.out.println("Pardent _ dir not failed"+"2"); } if(inputWorkbook.exists()== true) […]

在Android平板电脑上打开下载的Excel文件的问题

我正在处理一个应用程序,该应用程序使用系统中的数据生成一个excel文件。 excel文件在桌面上生成和下载很好,但是当我尝试在我的android平板电脑上下载它时,它不会打开。 它下载罚款,但打开时,一条消息告诉我,这不是一个有效的MS Excel文件。 它正试图下载的文件是从一个PHP脚本生成的,这些页眉在页面的顶部: header('Pragma: public'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '.gmdate('D, d MYH:i:s').' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: pre-check=0, post-check=0, max-age=0'); header('Pragma: no-cache'); header('Expires: 0'); header('Content-Transfer-Encoding: none'); header('Content-Type: application/vnd.ms-excel;'); header('Content-type: application/x-msexcel'); header('Content-Disposition: attachment; filename="Report.xls"'); // code below 我已经尝试了许多不同的标题,但没有任何作品。 点击运行的图标开始下载: top.document.location = 'script_that_generates_excel_file.php'; 我应该补充一点,在平板电脑上文件的大小是正确的,所以数据应该在那里。 任何想法是怎么回事? 为什么我无法打开平板电脑上的文件? 尝试在平板电脑上打开文件时出现错误: 北极星办公室: 打开文档时发生错误 纸张去: […]

在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 […]

无法访问NPOIFSFileSystem

我想读取xls和xlsx文件。 我使用这一行来访问我的工作簿。 myWorkBook = WorkbookFactory.create(file); 我的构buildgradle看起来像这样:apply plugin:'com.android.application' android { compileSdkVersion 19 buildToolsVersion "19.1.0" defaultConfig { applicationId "com.example.application" minSdkVersion 8 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/notice.txt' exclude 'META-INF/license.txt' […]

如何使用SQLiteAssetHelper将预先存在的数据库(从Excel创build)加载到Android设备中?

我想加载我的预先存在的数据库到我的Android设备。 我使用了这些步骤: 在github上使用外部库SQLiteAssetHelper 然后根据文档:编写一个包装类 public class DataBaseHelper extends SQLiteAssetHelper { private static final String TAG = "DataBaseHelper"; private static final String DATABASE_NAME = "test.db"; private static final int DATABASE_VERSION = 1; public DataBaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } private static final String TABLE_EXAMPLE = "example"; //example is the table name private static final […]

有什么办法可以在Android中打开xls表单吗?

我是Android新手,所以我知识有限。 任何人都可以让我知道是否有任何方式在Android中打开xls表单?