XLSX

Apache POI和excel操作

﹥>﹥吖頭↗ 提交于 2019-12-19 01:03:55
<!--添加依赖--> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.14</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.14</version> </dependency> 描述 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格式档案的功能 测试类 package com.study.test; import org.apache.poi.ss.usermodel.Cell; import org

Fast way to read xlsx files into R

社会主义新天地 提交于 2019-12-18 19:14:39
问题 It is a follow-up question to this one. What is the fastest way to read .xlsx files into R ? I use library(xlsx) to read in data from 36 .xlsx files. It works. However, the problem is that this is very time consuming (well over 30 minutes), especially when considering the data in each file is not that large (matrix of size 3*3652 in each file). To this end, is there a better to deal with such problem, please? Is there another quick way to read .xlsx into R? Or can I put the 36 files into a

Unreadable content in Excel file generated with EPPlus

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 18:54:22
问题 I'm having a little problem when I generate an Excel file from a template, using the EPPlus library. The file has a first spreadsheet that contains data that is used for populating pivot tables in the following sheets. When I open the generated file, I get the following error message : "Excel found unreadable content in 'sampleFromTemplate.xlsx'. Do you want to recover the contents of this workbook ? I you trust the source of this workbook, click Yes." I obviously click yes, then get a

How convert stream excel file to datatable C#?

*爱你&永不变心* 提交于 2019-12-18 12:29:21
问题 I use Epplus to reading xlsx files from stream. It has a bug , it cant read some columns in my workbook.How can read xlsx files from stream to datatable without epplus ? my older code: public static DataSet ReadExcelFile(Stream stream) { try { //2. Reading from a OpenXml Excel file (2007 format; *.xlsx) IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream); //... DataSet result = excelReader.AsDataSet(); return result; } catch (Exception x) { throw x; } } I didnt

EPPlus - How to use a template

假装没事ソ 提交于 2019-12-18 10:49:15
问题 I have recently discovered EPPlus (http://epplus.codeplex.com/). I have an excel .xlsx file in my project with all the styled column headers. I read on their site that you can use templates. Does anyone know how or can provide code sample of how to use my template.xlsx file with EPPlus? I would like to be able to simply load my data into the rows without messing with the headings. 回答1: The solution I ended up going with: using System.IO; using System.Reflection; using OfficeOpenXml; //Create

PHPExcel File format or extension is not valid

▼魔方 西西 提交于 2019-12-18 08:48:20
问题 I'm using phpexcel for export my query in excel file; however after I created file(which is xslx format), I can not open my file in excel. It gives "the file format or extension is not valid. Verify that the file has not been corrupted and that the file extension matches the file format of the file" error. When I open the file in texteditor(mine is npp) I see my php file's css codes and some part of my html codes. My code is like that; if( ! empty($_POST['export'])){ $query = "SELECT * FROM

PHPExcel File format or extension is not valid

左心房为你撑大大i 提交于 2019-12-18 08:48:12
问题 I'm using phpexcel for export my query in excel file; however after I created file(which is xslx format), I can not open my file in excel. It gives "the file format or extension is not valid. Verify that the file has not been corrupted and that the file extension matches the file format of the file" error. When I open the file in texteditor(mine is npp) I see my php file's css codes and some part of my html codes. My code is like that; if( ! empty($_POST['export'])){ $query = "SELECT * FROM

Write 16 bits character to .xlsx file using Apache POI in Java

被刻印的时光 ゝ 提交于 2019-12-18 06:57:45
问题 I have a problem in Apache POI. The problem is, I try to put a 16 bits character value (such as CJK Unified Ideographs Extension B) to .xlsx file. However, the cell value become a question mark(like ????) in generated .xlsx file. Anyone know how to handle the 16 bits character value in Apache POI with .xlsx format??? My POI version is 3.14 Code sample as below: XSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet sheet = workbook.createSheet("Test"); XSSFRow row1 = sheet.createRow(0);

Convert XLSM to XLSX

ε祈祈猫儿з 提交于 2019-12-18 06:57:30
问题 I'm using the EPPLUS library to read data from Excel to create another file. Unfortunately it does not support the .XLSM extension file. Is there a nice way to convert .XLSM files to .XLSX file for the purpose of reading the file with EPPLUS? (using EPPLUS for reading would be nice because all my code is already written using it :) ) 回答1: In order to do this you will need to use the Open XML SDK 2.0. Below is a snippet of code that worked for me when I tried it: byte[] byteArray = File

returning decimal instead of string (POI jar)

牧云@^-^@ 提交于 2019-12-17 17:12:16
问题 I need to read xls or xlsx sheet. successfully I read the sheet, but it returning decimal value instead of string (eg: for 3 -- it is returning 3.0). I need to read the cell values as it is. so I need to return as string 回答1: POI is giving you the exact value that Excel has stored in the File. Generally, if you write a number in an Excel cell, Excel will store that as a number with formatting. POI provides support to do that formatting for you if you want it (most people don't - they want the