"包装应包含的内容类型的一部分[M1.13] QUOT; [英] "Package should contain a content type part [M1.13]"
问题描述
我试图写一个Excel文件,但是我不断收到错误:
异常线程mainorg.apache.poi.POIXMLException:org.apache.poi.openxml4j.exceptions.InvalidFormatException:包装应包含的内容类型的一部分[M1.13]
块引用>据我了解我缺少一个jar文件。
谁能帮我找出哪个文件是?
P.S。我使用NetBeans。
进口java.io.FileInputStream中;
进口java.io.FileNotFoundException;
进口java.io.FileOutputStream中;
进口java.io.IOException异常;
进口javax.swing.JOptionPane中;
进口org.apache.poi.openxml4j.exceptions.InvalidFormatException;
进口org.apache.poi.xssf.usermodel.XSSFCell;
进口org.apache.poi.xssf.usermodel.XSSFRow;
进口org.apache.poi.xssf.usermodel.XSSFSheet;
进口org.apache.poi.xssf.usermodel.XSSFWorkbook;/ **
*
* @author nicholaskissaun
* /公共类测试仪{ 公共静态无效的主要(字符串ARGS \\ [\\])抛出FileNotFoundException异常,IOException异常,InvalidFormatException {
INT行数= 7,iChoice;
串sChoice;
XSSFSheet S;
XSSFRow ROW1;
XSSFWorkbook WB;
XSSFCell R1C1,R1C2,r1c8,r1Episodes; FIS的FileInputStream =新的FileInputStream(/用户/ nicholaskissaun /谷歌驱动器/等级11_12 /计算机科学/的Java /起租1 / src目录/ IA /型材/贝基/ ShowDetails.xlsx);
WB =新XSSFWorkbook(FIS);
S = wb.getSheetAt(0); }}
解决方案检查Excel格式....首先,我创建了一个样本与POI擅长,我改变了列与我首先尝试给它同样的错误,但很少尝试后,成功读取。我不知道为什么它没有工作第一次运行:(
但如果你有正确的库,请检查正确的Excel格式I am attempting to write to an Excel file however I keep getting the error:
Exception in thread "main" org.apache.poi.POIXMLException: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13]
From what I understand I am missing a jar file.
Can anyone help me identify which file it is?
P.S. I am using Netbeans.
import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import javax.swing.JOptionPane; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; /** * * @author nicholaskissaun */ public class Tester { public static void main (String args \[\])throws FileNotFoundException, IOException, InvalidFormatException{ int RowCount = 7, iChoice; String sChoice; XSSFSheet s; XSSFRow row1; XSSFWorkbook wb; XSSFCell r1c1, r1c2, r1c8, r1Episodes; FileInputStream fis = new FileInputStream("/Users/nicholaskissaun/Google Drive/Grade 11_12/Computer Science/Java/Term1/src/IA/Profiles/Becky/ShowDetails.xlsx"); wb = new XSSFWorkbook(fis); s = wb.getSheetAt(0); } }
解决方案CHECK EXCEL FORMAT .... Firstly I created an sample excel with poi and I changed the columns with mine first attempt it give same error but after few try it successfully read .I wonder why it didn't worked first run :( but If you have right library please check the correct excel format
这篇关于"包装应包含的内容类型的一部分[M1.13] QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!