java POI 读取excel文件报错误Invalid header signature 10C

java POI 读取excel文件报错误Invalid header signature 查找了资料说是读取的是非标准的excel文件,我用文本编辑器打开文件是把html的table转换成的excel文件 ,请问你这个怎么解决呢?(不需要打开另存为的方式来解决哦,另存为excel文件就可以导入)

4个回答

原因和解决办法都很明确:

问题根源是文件格式不对,不是真正的.xls。
解决办法是在Excel打开,另存为.xls。

不过你特意强调不要用另存为,不太清楚是什么原因?

shanxixixixixi
shanxixixixixi 客户嫌这种太麻烦了呀 因为导出的文件比较多 不想每次都去手动操作一下
2 年多之前 回复

应该是html的table转换成excel时,头信息不对. 看看这里的代码.

shanxixixixixi
shanxixixixixi 我拿不到这里的代码的 客户给的就是已经导出的excel文件 需要导入到另一套系统
2 年多之前 回复

楼上正解,应该是表头的问题

客户嫌这种太麻烦了呀 因为导出的文件比较多 不想每次都去手动操作一下

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
POI读取EXCEL文件的错误(invalid header signature )处理
如题,网上很多说是获取信息头部出错,保存或者另存为就可以,我试了下的确可以,但是我不用保存,只要打开下或者重命名也能读取了,打开也没显示格式错误,更重要的是我功能是读取客户端的excel..不可能每次都手动操作,我现在实现的功能是用jsp的FileUpload上传的临时区用poi存储,有没高手帮忙解决![图片说明](http://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/001/face/5.gif)更奇怪的是我在eclipse调试却完全没问题,这很重要,已经穷途末路,大家给点意见
Invalid header signature POI的解决方案
NULL 博文链接:https://universes.iteye.com/blog/854485
【POI读取EXCEL模板抛错】java.io.IOException: Invalid header signature;
具体异常如下:rn[code=Java]rnjava.io.IOException: Invalid header signature; read 17734853669885026, expected -2226271756974174256rn at org.apache.poi.poifs.storage.HeaderBlockReader.(HeaderBlockReader.java:100)rn at org.apache.poi.poifs.filesystem.POIFSFileSystem.(POIFSFileSystem.java:84)rn at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:257)rn at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:238)rn at org.appfuse.webapp.action.OrderManageAction.export(OrderManageAction.java:244)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)rn at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.appfuse.webapp.filter.EncodingFilter.doFilter(EncodingFilter.java:50)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)rn at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)rn at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)rn at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)rn at java.lang.Thread.run(Thread.java:619)rnrn[/code]rnrn【-------[color=#FF0000]Action[/color]--------】rn[code=Java]rn ServletOutputStream os = response.getOutputStream(); //获得输出流 rn response.reset(); //清空输出流 rn String fileName = new String("订单列表".getBytes("gb2312"), "ISO8859-1") +".xls"; rn response.setHeader("Content-disposition", "attachment; filename="+ fileName); //设定输出文件头 rn response.setContentType("application/msexcel"); //定义输出类型 rn rn String filePath = request.getSession().getServletContext().getRealPath("/excel/model/order.xls"); rn rn HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(filePath)); //读取excel模板---程序跑到这,再往下走就抛错了。rnrnrn请大师们看下是哪的问题rnrn[/code]
Invalid header signature
<%nresponse.setContentType("applicationnd.ms-excel");nresponse.setHeader("Content-Disposition","attachment;filename=WIPMaintenance.xls");n%>n这样导出excel后用poi读取excel 总是报nInvalid header signature; read 0x0A0D0A0D0A0D0A0D, expected 0xE11AB1A1E011CFD0 这个错误肿么回事..
微信分享iphone端报invalid signature错误
把获取的 location.href.split(&quot;#&quot;)[0]; encode一下就行了. var url = encodeURIComponent(location.href.split(&quot;#&quot;)[0]);  
poi读取Excel文件报异常
最近使用poi操作Excel时,在读取Excel到文件到文件流中时,抛出一下异常:rnorg.apache.poi.hssf.record.RecordFormatException: String record was supplied but formula record flag is not setrn at org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate.(FormulaRecordAggregate.java:51)rn at org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.construct(ValueRecordsAggregate.java:159)rn at org.apache.poi.hssf.record.aggregates.RowRecordsAggregate.(RowRecordsAggregate.java:89)rn at org.apache.poi.hssf.model.Sheet.createSheet(Sheet.java:219)rn at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:281)rn at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:196)rn at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:313)rn at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:294)rn at com.nec.nes.eks.importEmployeeAttendance.service.ImportEmployeeAttendanceService.getEmployeeAttendanceFromXls(ImportEmployeeAttendanceService.java:164)rn at com.nec.nes.eks.importEmployeeAttendance.action.ImportEmployeeAttendanceAction.uploadAnalyzeFile(ImportEmployeeAttendanceAction.java:167)rn at com.nec.nes.eks.importEmployeeAttendance.action.ImportEmployeeAttendanceAction.exe(ImportEmployeeAttendanceAction.java:86)rn at com.nec.nes.comn.core.action.BaseAction.execute(BaseAction.java:79)rn at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)rn at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)rn at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)rn at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)rn at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)rn at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)rn at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)rn at com.nec.nes.comn.core.servlet.OurActionServlet.service(OurActionServlet.java:96)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)rn at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)rn at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)rn at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)rn at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)rn at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)rn at java.lang.Thread.run(Unknown Source)rn--------------------------------------------------------------------------------------------------------------rn在网上搜了很长时间,没有找到正确答案,通过自己实践,找出原因。rn在用poi读取Excel时,应保证Excel文件默认选中的是第一个sheet页,即异常中的提示:String record was supplied but formula record flag is not set
maven异常invalid LOC header (bad signature)
![图片说明](https://img-ask.csdn.net/upload/201701/06/1483675559_845981.png)nnn```n n n spinachn com.yangn 2.0.0n n 4.0.0n spinach-cmsn warn spinach-cmsn http://maven.apache.orgnn n spinach-cmsn n n org.apache.maven.pluginsn maven-war-pluginn 2.6n n falsen n n n nnn```nn完全看不出来哪有问题...n
invalid LOC header (bad signature) 求解决
严重: Unable to process Jar entry [com/google/common/collect/Iterators$6.class] from Jar [jar:file:/C:/Users/Administrator/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Demo1/WEB-INF/lib/guava-15.0.jar!/] for annotationsnjava.util.zip.ZipException: invalid LOC header (bad signature)n at java.util.zip.ZipFile.read(Native Method)n at java.util.zip.ZipFile.access$1400(ZipFile.java:60)n at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:717)n at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:419)n at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)n at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)n at java.io.BufferedInputStream.read(BufferedInputStream.java:265)n at java.io.DataInputStream.readInt(DataInputStream.java:387)n at org.apache.tomcat.util.bcel.classfile.ClassParser.readID(ClassParser.java:201)n at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:80)n at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2089)n at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1965)n at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1931)n at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1916)n at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1330)n at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)n at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)n at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)n at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)n at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5405)n at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)n at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)n at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)n at java.util.concurrent.FutureTask.run(FutureTask.java:266)n at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)n at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)n at java.lang.Thread.run(Thread.java:745)n
文件读取异常:java.io.IOException: Invalid header signature;
错误提示信息:如下rn文件读取异常:java.io.IOException: Invalid header signature; read 0xE011BDBFEFBDBFEF, expected 0xE11AB1A1E011CFD0rnrn模拟的是表单提交 表单中含有一个excel文件。rn手动上传OK rn模拟上传提示文件读取异常。
解决invalid LOC header (bad signature)问题
invalid LOC header (bad signature)问题解决,快速查找与删除有问题的jar包
JAVA使用POI读取EXCEL错误
一讀取EXCEL就會拋出如下異常rn[code=Java]rnjava.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:513)rn at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:224)rn at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:160)rn at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:163)rn at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:210)rn at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:191)rn at com.emis.app.pbo.dep.emisQuoteExcelToDB.quoteExcelToDb(emisQuoteExcelToDB.java:63)rn at com.emis.app.pbo.dep.emisQuoteExcelToDB.(emisQuoteExcelToDB.java:47)rn at _jsp._dep._bestdaybp_0upload_0xls__jsp._jspService(_bestdaybp_0upload_0xls__jsp.java:96)rn at com.caucho.jsp.JavaPage.service(JavaPage.java:75)rn at com.caucho.jsp.Page.subservice(Page.java:506)rn at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)rn at com.caucho.server.http.Invocation.service(Invocation.java:315)rn at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)rn at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)rn at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:164)rn at com.caucho.server.TcpConnection.run(TcpConnection.java:139)rn at java.lang.Thread.run(Thread.java:662)rnCaused by: java.lang.ArrayIndexOutOfBoundsExceptionrn at java.lang.System.arraycopy(Native Method)rn at org.apache.poi.hssf.record.UnknownRecord.(UnknownRecord.java:62)rn at org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:57)rn at org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)rn at org.apache.poi.hssf.record.Record.fillFields(Record.java:90)rn at org.apache.poi.hssf.record.Record.(Record.java:55)rn at org.apache.poi.hssf.record.ObjRecord.(ObjRecord.java:61)rn ... 21 morern[/code]rn經過調試是 HSSFWorkbook hssfWorkbook = new HSSFWorkbook(inStream);錯誤,請大神幫助
解决微信分享iphone端报invalid signature
之前分享用的好好的,但是没有用苹果机测试. 后来才发现页面会报错误. 直接写解决方法了. 把targetUrl进行encode一下就行了. 原先是这样的 var targetUrl = location.href.split("#")[0]; 修改后: var targetUrl = encodeURIComponent(location.href.split("
微信一直报invalid signature错误解决
关于微信JS-SDK调用失败问题,如果你在排除官方给出的可能问题处理都没有解决的话, 那么,你可以参考我下面的这句话。 有很大可能是服务器的动态IP引起的。当出现签名错误时,有可能是微信服务器解析域名时, 把该域名的IP地址解析的结果,和在公众号网页上,自己配置的IP白名单不一致引起。亲身经历的坑。
Java用poi读取excel文件
Java用poi读取excel文件 。利用单元格对象可以获得它的值,提取单元格的值时请注意它的类型:
java POI读取excel文件数据
将excel文件中的内容通过java文件读取出来,包括总行数,列数,单元格内容,合并单元格,行高,列宽,图片等信息。
Java使用POI读取Excel文件
待续
微信分享报invalid signature签名错误解决方法
微信分享报invalid signature签名错误,解决方法
安卓调用微信sdk正常,ios报invalid signature的错误
最近在调用微信sdk的接口,自己的安卓手机测试的好好的,等到测试的时候,iphone的部分手机报签名的错误,我也是很纳闷了,一步步的按照文档上来写的,安卓手机没有问题说明后台的逻辑肯定是对的,所以一一排除,问题有可能出现在前端,那么最大的问题就是url,文档上是将url location.href.split('#')[0] 传递到后台的,但是在发送get请求的时候,这个url地址就变了,所以前台...
ObjectInputStream错误:invalid stream header
我在读取文件时,通过FileInputStream创建一个输入流,用它创建一个ObjectInpuStream对象,但报错说是: invalid stream header.不知道怎么回事. 我刚介入JAVA,哪位能帮个忙?rn部分代码:rnFileInputStream fis = new FileInputStream(filename);rnObjectInputStream ois = new ObjectInputStream(fis);//到这儿就报错:invalid stream header.
POI 读取Excel文件
POI 读取Excel文件 POI 读取Excel文件
POI读取Excel文件
项目中需要读取一些客户提供的EXCEL文件 需要将这些数据保存到数据库中 这就需要使用POI对excel进行读取 主要思路: 1,使用POI读取excel中每行的数据作为一条记录,对应生成一条insert语句 2,需要对应字段,也就是Excel中的sheet对应表,列对应field 3,如果excel是模板式数据,即每列代表什么是规定好的,那么很简单,通过硬编码来实现 4,如果e...
poi读取Excel文件
前段时间在做poi读取Excel,百度了很多人的方法,在实际运行中都会出现列读取为空或者行读取为空的BUG,所以干脆对照着POI的API文档自己写了一个工具类,使用我这个工具类需要引入poi-ooxml-3.8-20120326.jar以及commons等支持包,接下来上代码: import java.io.File; import java.io.FileInputStream; impor...
poi读取Excel2007文件
excel2007同之前excel97-2003在存储数据量上有很大差别,可以使用apache下的poi来实现 poi版本3.6以上   import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; ...
使用poi读取excel文件
注:读取的文件格式是xls,如果xlsx格式文件,可以自己通过excel文件右键→另存为,转换一下格式 导包 &lt;dependency&gt; &lt;groupId&gt;org.apache.poi&lt;/groupId&gt; &lt;artifactId&gt;poi&lt;/artifactId&gt; &lt;version&gt;3.17&lt;/ver...
poi读取excel文件
最新版poi 相关6个jar包 for java。Java读取Excel表格数据时(.xls、.xlsx 格式),需要引用的jar包 亲测as上可以读取到2010excel内容,内附读取源码
poi 读取Excel文件的问题
poi 读取的Excel有什么要求吗?问什么我读通过POI创建的文件时没有错,但读取一个稍微复杂点的文件时就出现异常呢?rn异常信息如下:rnjava.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rnrn at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)rnrn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sournrce)rn at java.lang.reflect.Constructor.newInstance(Unknown Source)rn at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.jrnava:224)rn at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.rnjava:160)rn at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:1rn63)rn at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:1rn30)rn at ReadExcel.main(ReadExcel.java:35)rnCaused by: java.lang.ArrayIndexOutOfBoundsExceptionrn at java.lang.System.arraycopy(Native Method)rn at org.apache.poi.hssf.record.UnknownRecord.(UnknownRecord.java:62rn)rn at org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:5rn7)rn at org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)rn at org.apache.poi.hssf.record.Record.fillFields(Record.java:90)rn at org.apache.poi.hssf.record.Record.(Record.java:55)rn at org.apache.poi.hssf.record.ObjRecord.(ObjRecord.java:61)rn ... 9 more
利用POI读取EXCEL文件
public class ExcelReaderByPoi{ public void readExcel(String filePath){   InputStream is;   try {    is = new FileInputStream(filePath);    HSSFWorkbook book = null;    book = new HSSFWorkb...
poi/jxl读取excel文件
dom4j是一套非常优秀的java开源api,主要用于读写xml文档,具有性能优异、功能强大、和非常方便使用的特点。 另外xml经常用于数据交换的载体,像调用webservice传递的参数,以及数据做同步操作等等, 所以使用dom4j解析xml是非常有必要的。
使用POI读取excel文件
以下是我自己用的一个完整的例子:在使用之前在项目中导入poi的jar包就可以了。详细说明见备注。 package com.smartsky.virtualModel.POI; import java.io.FileInputStream; import java.io.InputStream; import java.util.Iterator; import org.apache.
POI读取Excel文件数据
1.封装类 import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.*; import java.io.InputStream; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; ...
POI生成Excel文件/POI读取Excel文件
package com.ultrapower.gcos.common; import com.ultrapower.gcos.entity.app.AppManage; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss
config:invalid signature 微信开发遇到这个错误
首先,我是保证了我取得的所以签名的参数经我签名计算后,和微信提供的 微信 JS 接口签名校验工具 https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=jsapisign  计算的结果一致。经排除,是url的参数中带有服务器端口,可微信那边执行签名计算的url不带端口号,因此出现了错误。 写上,以备后查,和遇到相同问题的同学参考。
微信公众号签名错误 invalid signature
在h5上做微信分享的时候,遇到一个奇怪的问题,wx:config有时候提示ok,有时候提示签名错误,通过微信 JS 接口签名校验工具校验也是没有问题。最后看网上大家说的解决方法,大部分是url有问题,于是对url进行encodeURIComponent,解决。...
微信JSSDK invalid signature
申请了JSSDK,配置完了以后,PC端打印日志都正常,到手机端就出问题了 ,各种invalid signature。。rnrnphp代码如下:rn[code=php]rn /*----------- 微信JS-SDK API(获取Token) -----------*/rn function getAccessToken() rn $data = json_decode(file_get_contents('access_token.json'));rn if ($data->expire_time < time()) rn $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=保密&secret=保密';rn $res = json_decode($this->httpGet($url));rn $access_token = $res->access_token;rn if ($access_token) rn $data->expire_time = time() + 7000;rn $data->access_token = $access_token;rn $fp = fopen('access_token.json', 'w');rn fwrite($fp, json_encode($data));rn fclose($fp);rn rn else rn $access_token = $data->access_token;rn rn return $access_token;rn rnrn /*----------- 微信JS-SDK API(获取Ticket) -----------*/rn function getJsApiTicket() rn $data = json_decode(file_get_contents('jsapi_ticket.json'));rn if ($data->expire_time < time()) rn $accessToken = $this->getAccessToken();rn $url = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token='.$accessToken;rn $res = json_decode($this->httpGet($url));rn $ticket = $res->ticket;rn if ($ticket) rn $data->expire_time = time() + 7000;rn $data->jsapi_ticket = $ticket;rn $fp = fopen('jsapi_ticket.json', 'w');rn fwrite($fp, json_encode($data));rn fclose($fp);rn rn else rn $ticket = $data->jsapi_ticket;rn rn return $ticket;rn rnrn /*----------- 微信JS-SDK API(生成签名) -----------*/rn public function getSign() rn $jsapiTicket = $this->getJsApiTicket();rn $nonceStr = $this->createNonceStr();rn $timestamp = time();rn $url = $_POST['url'];rn $string = 'jsapi_ticket='.$jsapiTicket.'&noncestr='.$nonceStr.'&timestamp='.$timestamp.'&url='.$url;rn $signature = sha1($string);rn $signPackage = array(rn 'appId' => '保密',rn 'nonceStr' => $nonceStr,rn 'timestamp' => $timestamp,rn 'url' => $url,rn 'signature' => $signature,rn 'rawString' => $stringrn );rn $this->myajaxReturn($signPackage, 'success', '200');rn [/code]rnrnjs代码如下:rn[code=javascript]rn/*------------------------- 微信分享(分享链接发生变更,重新请求签名) -------------------------*/rnfunction getSign() rn var tmpurl = location.href.split('#')[0];rn var shareurl = tmpurl + '?type=1&id=' + user_id + '&dater=' + search_text;rn shareurl = encodeURIComponent(shareurl);rn $.ajax(rn url: '服务端控制器(保密)/getSign',rn type: 'POST',rn dataType: 'json',rn timeout: 5000,rn data: url: shareurl ,rn success : function(data) rn console.log(data);rn registWXShare(data.data);rn ,rn error: function() rn setTimeout(function() rn registWXShare();rn ,1000);rn rn );rnrn/*------------------------- 微信分享(注册分享监听) -------------------------*/rnfunction registWXShare(data) rn // 微信分享初始化rn wx.config(rn debug: true,rn appId: data.appId,rn timestamp: data.timestamp,rn nonceStr: data.nonceStr,rn signature: data.signature,rn jsApiList: [rn 'onMenuShareTimeline',rn 'onMenuShareAppMessage',rn 'onMenuShareQQ'rn ]rn );rnrn // 微信分享监听rn wx.ready(function() rn var shareData = rn title: '这是活动的介绍页',rn desc: '这里是发送给好友的时候的简介',rn link: data.url,rn imgUrl: imgurlrn ;rn // 分享给朋友rn wx.onMenuShareAppMessage(rn title: '互联网之子',rn desc: '在长大的过程中,我才慢慢发现,我身边的所有事,别人跟我说的所有事,那些所谓本来如此,注定如此的事,它们其实没有非得如此,事情是可以改变的。更重要的是,有些事既然错了,那就该做出改变。',rn link: data.url,rn imgUrl: imgurl,rn trigger: function (res) ,rn success: function (res) alert('已分享'); ,rn cancel: function (res) alert('已取消'); ,rn fail: function (res) alert(JSON.stringify(res)); rn );rnrn // 分享到朋友圈rn wx.onMenuShareTimeline(rn title: '互联网之子',rn link: data.url,rn imgUrl: imgurl,rn trigger: function (res) ,rn success: function (res) alert('已分享'); ,rn cancel: function (res) alert('已取消'); ,rn fail: function (res) alert(JSON.stringify(res)); rn );rnrn // 分享到QQrn wx.onMenuShareQQ(rn title: '互联网之子',rn desc: '在长大的过程中,我才慢慢发现,我身边的所有事,别人跟我说的所有事,那些所谓本来如此,注定如此的事,它们其实没有非得如此,事情是可以改变的。更重要的是,有些事既然错了,那就该做出改变。',rn link: data.url,rn imgUrl: imgurl,rn trigger: function (res) ,rn complete: function (res) alert(JSON.stringify(res)); ,rn success: function (res) alert('已分享'); ,rn cancel: function (res) alert('已取消'); ,rn fail: function (res) alert(JSON.stringify(res)); rn );rn wx.onMenuShareAppMessage(shareData);rn wx.onMenuShareTimeline(shareData);rn wx.onMenuShareQQ(shareData);rn );rnrn // 失败监听rn wx.error(function (res) alert(res.errMsg); );rnrn[/code]rnrn内心已然是崩溃的了。。求大神协助。。
一直报错invalid signature
签名signature在验签工具上没错。n页面URL与参与验签的URL一致,不过URL带了端口号 8003。nJS安全域名配置没有带上端口号,因为加上端口号就会域名不合法。n大小写也没有问题。n实在是不知道怎么回事了!!??求大佬指点!!n![图片说明](https://img-ask.csdn.net/upload/201710/24/1508846837_658181.png)
java利用poi读取excel
java语言使用poi来读写excel,文件里有代码案例和所需jar。
Java Poi创建与读取Excel
Apache POI 下载 创建Excel表 public class Test { /** 存储路径 */ private static String path = "E:/Student.xls"; /** 列表信息 */ private static List&lt;...
Java使用POI读取Excel
需要的jar包 poi-ooxml-3.8.jar poi-ooxml-schemas-3.8.jar poi-scratchpad-3.8.jar dom4j-1.6.1.jar xmlbeans-2.3.0.jar 读取excel import java.io.FileInputStream; import java.io.FileNotFoundException; i...
java读取excel poi 方法
文档详细介绍了java中创建和读取excel的方法,非常实用,特此推荐。
JAVA poi 读取excel 通用模板
excel poi java
相关热词 c# 标准差 计算 c#siki第五季 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池