请教高手!!!! 还用office呀,改用open office吧,它是完全基于XML的,读写都很方便!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 NODNOD,open office ,office好垃圾 http://jakarta.apache.org/poi/index.htmlPOI:Java API To Access Microsoft Format Files 我晕难道就没人知道吗?我知道用open office能够解决,但现在的问题是我在用微软的Office啊 俺晕,gdsean(摇滚java) 不是说了嘛。 天啦,想不到CSDN里连个高手都没有。这个小问题都没有人回答得出来吗?:(好郁闷。我已经想到方法了,而且实现了,不过只是一个文件一个文件的读取,不能够一次读出多个文件,有谁知道方法吗? TO xiaohaozi2101(一剑无血): 呵呵,俺们本来就是靠“混”的。你所说的实现俺还想多问一句?就是把后缀为".doc"的word文件读到内存中吗?能给俺们介绍一下你如何实现的吗?大致思路就可以了。 对了,另外说一下,POI项目正在研究是不错,而且一直都在研究。但是现在已经有发布版可以下载了。而且现在已经发布到了 1.5.1 了。如果找不到,俺把URL贴在下面:<<http://nagoya.apache.org/mirror/jakarta/poi/release/>>:) OK 我的思路是:我能够选择多个.doc文件,然后在后台进行处理,把这些.doc的资料进行解析出来,存到数据库里面去。 你给的这个POI我已经下载了,谢谢不过下是下了,就是不知道怎么用?你能帮助我吗?这个东东具体是怎么实现的? 我现在用的是一个就做Majix的一个东东,里面可以把.doc文档转换成为XML标记语言,然后再根据java去提取,我现在的问题就是Majix只能一个文件一个文件的解析,我不知道如何一次性解析多个文档. TO: xiaohaiz(老土进城,两眼通红) 你给的这个包我以前用过,但是我只能实现对Excel表进行提取,Word文档的提取我还没试过,不知道用什么方法>?我用Google搜索了一下,用java来提取.doc的方法根本就是太少了。我现在只能先把.doc文档转换成XML才可能实现了。 TO xiaohaozi2101(一剑无血) :呵呵,很久没有跟踪POI了,俺看了一下1.5.1final release,现在确实只实现了HSSF (Horrible Spreadsheet Format)的支持,能够解析Excel97-xp的文档。而解析word97-xp的HDF (Horrible Document Format)的支持,俺看文档说应该在2.0release的时候提供lib。所以你现在可以暂时不考虑POI了,呵呵。 这是我用Majix解析出来的XML,但是我用java解析下面这个XML的时候,竟然提示错误,解析不出来! 解析XML的方法有好几种,你一般用哪种方法实现比较容易呢?帮我看看这个XML该怎么解出来好吗?可以帮我解析一下这个文件吗?万分感谢了。。呵呵。。麻烦你了:)<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?><?xml:stylesheet type="text/xsl" href="sdocbook.xsl"?><!-- generated by Majix from F:\3.doc on Thu Dec 04 16:19:29 CST 2003 using template SDocBook --><!DOCTYPE article PUBLIC "-//Normaln Walsh//DTD Simplified DocBk XML V3.1.4.1//EN" "..\..\sdocbook\sdocbook.dtd" []><article><table><row><cell><para></para><para></para><para><emphasis>Ö</emphasis><emphasis>Ð</emphasis><emphasis>¹</emphasis><emphasis>ú</emphasis><emphasis>´</emphasis><emphasis>ó</emphasis><emphasis>Ì</emphasis><emphasis>Æ</emphasis><emphasis>¼</emphasis><emphasis>¯</emphasis><emphasis>Í</emphasis><emphasis>Å</emphasis><emphasis>¹</emphasis><emphasis>«</emphasis><emphasis>Ë</emphasis><emphasis>¾</emphasis></para><para><emphasis>¹</emphasis><emphasis>¤</emphasis><emphasis>³</emphasis><emphasis>Ì</emphasis><emphasis>¹</emphasis><emphasis>Ü</emphasis><emphasis>À</emphasis><emphasis>í</emphasis><emphasis>×</emphasis><emphasis>¨</emphasis><emphasis>Ò</emphasis><emphasis>µ</emphasis><emphasis>È</emphasis><emphasis>Ë</emphasis><emphasis>²</emphasis><emphasis>Å</emphasis><emphasis>¿</emphasis><emphasis>â</emphasis><emphasis>É</emphasis><emphasis>ê</emphasis><emphasis>±</emphasis><emphasis>¨</emphasis><emphasis>±</emphasis><emphasis>í</emphasis></para></cell></row><row><cell><para><c color='black'>name</c></para></cell><cell><para><c color='black'>Horry</c></para></cell><cell><para><c color='black'>sex</c></para></cell><cell><para><c color='black'>male</c></para></cell><cell><para><c color='black'>Year</c></para></cell><cell><para><c color='black'>74.07</c></para></cell></row><row><cell><para><c color='black'>College</c></para></cell><cell><para><c color='black'>C</c><c color='black'>hasha.college</c></para></cell><cell><para><c color='black'>Time</c></para></cell><cell><para><c color='black'>95.07</c></para></cell><cell><para><c color='black'>level</c></para></cell><cell><para><c color='black'>junior college</c></para></cell></row><row><cell><para><c color='black'>Number</c></para></cell><cell><para><c color='black'>430419750225053</c></para></cell><cell><para><c color='black'>degree</c></para></cell><cell><para><c color='black'>Null</c></para></cell></row><row><cell><para><c color='black'>specialty</c></para></cell><cell><para><c color='black'>computer</c></para></cell><cell><para><c color='black'>specialty</c></para></cell><cell><para><c color='black'>computer</c></para></cell></row><row><cell><para><c color='black'>W</c><c color='black'>ork </c><c color='black'>type</c></para></cell><cell><para><c color='black'>empolder</c></para></cell><cell><para><c color='black'>W</c><c color='black'>ork </c><c color='black'>type</c></para></cell><cell><para><c color='black'>empolder</c></para></cell></row><row><cell><para><c color='black'>W</c><c color='black'>ork </c><c color='black'>unit</c></para></cell><cell><para><c color='black'>Lei</c> <c color='black'>eletricity</c></para></cell><cell><para><c color='black'>dut</c><c color='black'>y</c></para></cell><cell><para><c color='black'>NULL</c></para></cell></row><row><cell><para><c color='black'>duty</c></para></cell><cell><para><c color='black'>technician</c></para></cell><cell><para><c color='black'>phone</c></para></cell><cell><para><c color='black'>2363</c></para></cell><cell><para><c color='black'>faxes</c></para></cell><cell><para><c color='black'>Null</c></para></cell></row><row><cell><para><c color='black'>Family</c><c color='black'> phone</c></para></cell><cell><para><c color='black'>4189</c></para></cell><cell><para><c color='black'>E_mail</c></para></cell><cell><para><c color='black'>[email protected]</c></para></cell><cell><para><c color='black'>combined set</c></para></cell><cell><para><c color='black'>000</c></para></cell></row><row><cell><para><c color='black'>Address</c></para></cell><cell><para><c color='black'>Lei</c> <c color='black'>eletricity</c></para></cell><cell><para><c color='black'>Mail</c></para></cell><cell><para><c color='black'>421800</c></para></cell></row><row><cell><para><c color='black'>¹</c><c color='black'>¤</c><c color='black'>×</c><c color='black'>÷</c><c color='black'>¼</c><c color='black'>ò</c><c color='black'>À</c><c color='black'>ú</c></para></cell><cell><para><c color='black'>1995-2003 </c><c color='black'>Lei</c> <c color='black'>eletricity</c></para></cell></row><row><cell><para><c color='black'>success</c></para></cell><cell><para></para><para><c color='black'>Null</c></para></cell></row><row><cell><para><c color='black'>commend</c> <c color='black'>idea</c></para></cell><cell><para><c color='black'>Null</c></para></cell></row></table><para></para></article> 根据xml抽象出你自己的数据结构。比如结果是table和para的聚集。table是row的聚集,row是cell的聚集,cell是para的聚集,para是emphasis和c的聚集,etc。针对这个数据结构再构建相应的方法。可以尝试一下。 关于java程序和windows服务 如何在websphere 上 配置ssl,双向认证?请教了 怎么看书 有关字符串的替换问题(在线等!!!) junit ant 的问题 java socket连接问题 一个小问题 请指点 谢谢 关于javap的使用问题 谁有unicode字符表啊? 求助 关于线程的SCJP试题!! #########关于外观风格,知道的朋友进来一下,有分!######### 两个简单的问题
office好垃圾
POI:Java API To Access Microsoft Format Files
我已经想到方法了,而且实现了,不过只是一个文件一个文件的读取,不能够一次读出多个文件,有谁知道方法吗?
你所说的实现俺还想多问一句?就是把后缀为".doc"的word文件读到内存中吗?
能给俺们介绍一下你如何实现的吗?大致思路就可以了。
如果找不到,俺把URL贴在下面:
<<
http://nagoya.apache.org/mirror/jakarta/poi/release/
>>:)
你给的这个包我以前用过,但是我只能实现对Excel表进行提取,Word文档的提取我还没试过,不知道用什么方法>?我用Google搜索了一下,用java来提取.doc的方法根本就是太少了。我现在只能先把.doc文档转换成XML才可能实现了。
呵呵,很久没有跟踪POI了,俺看了一下1.5.1final release,现在确实只实现了HSSF (Horrible Spreadsheet Format)的支持,能够解析Excel97-xp的文档。而解析word97-xp的HDF (Horrible Document Format)的支持,俺看文档说应该在2.0release的时候提供lib。
所以你现在可以暂时不考虑POI了,呵呵。
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<?xml:stylesheet type="text/xsl" href="sdocbook.xsl"?>
<!-- generated by Majix from F:\3.doc on Thu Dec 04 16:19:29 CST 2003 using template SDocBook -->
<!DOCTYPE article PUBLIC "-//Normaln Walsh//DTD Simplified DocBk XML V3.1.4.1//EN" "..\..\sdocbook\sdocbook.dtd" [
]>
<article>
<table>
<row><cell><para></para><para></para><para><emphasis>Ö</emphasis><emphasis>Ð</emphasis><emphasis>¹</emphasis><emphasis>ú</emphasis><emphasis>´</emphasis><emphasis>ó</emphasis><emphasis>Ì</emphasis><emphasis>Æ</emphasis><emphasis>¼</emphasis><emphasis>¯</emphasis><emphasis>Í</emphasis><emphasis>Å</emphasis><emphasis>¹</emphasis><emphasis>«</emphasis><emphasis>Ë</emphasis><emphasis>¾</emphasis></para><para><emphasis>¹</emphasis><emphasis>¤</emphasis><emphasis>³</emphasis><emphasis>Ì</emphasis><emphasis>¹</emphasis><emphasis>Ü</emphasis><emphasis>À</emphasis><emphasis>í</emphasis><emphasis>×</emphasis><emphasis>¨</emphasis><emphasis>Ò</emphasis><emphasis>µ</emphasis><emphasis>È</emphasis><emphasis>Ë</emphasis><emphasis>²</emphasis><emphasis>Å</emphasis><emphasis>¿</emphasis><emphasis>â</emphasis><emphasis>É</emphasis><emphasis>ê</emphasis><emphasis>±</emphasis><emphasis>¨</emphasis><emphasis>±</emphasis><emphasis>í</emphasis></para>
</cell></row><row><cell><para><c color='black'>name</c></para>
</cell>
<cell><para><c color='black'>Horry</c></para>
</cell>
<cell><para><c color='black'>sex</c></para>
</cell>
<cell><para><c color='black'>male</c></para>
</cell>
<cell><para><c color='black'>Year</c></para>
</cell>
<cell><para><c color='black'>74.07</c></para>
</cell></row><row><cell><para><c color='black'>College</c></para>
</cell>
<cell><para><c color='black'>C</c><c color='black'>hasha.college</c></para>
</cell>
<cell><para><c color='black'>Time</c></para>
</cell>
<cell><para><c color='black'>95.07</c></para>
</cell>
<cell><para><c color='black'>level</c></para>
</cell>
<cell><para><c color='black'>junior college</c></para>
</cell></row><row><cell><para><c color='black'>Number</c></para>
</cell>
<cell><para><c color='black'>430419750225053</c></para>
</cell>
<cell><para><c color='black'>degree</c></para>
</cell>
<cell><para><c color='black'>Null</c></para>
</cell></row><row><cell><para><c color='black'>specialty</c></para>
</cell>
<cell><para><c color='black'>computer</c></para>
</cell>
<cell><para><c color='black'>specialty</c></para>
</cell>
<cell><para><c color='black'>computer</c></para>
</cell></row><row><cell><para><c color='black'>W</c><c color='black'>ork </c><c color='black'>type</c></para>
</cell>
<cell><para><c color='black'>empolder</c></para>
</cell>
<cell><para><c color='black'>W</c><c color='black'>ork </c><c color='black'>type</c></para>
</cell>
<cell><para><c color='black'>empolder</c></para>
</cell></row><row><cell><para><c color='black'>W</c><c color='black'>ork </c><c color='black'>unit</c></para>
</cell>
<cell><para><c color='black'>Lei</c> <c color='black'>eletricity</c></para>
</cell>
<cell><para><c color='black'>dut</c><c color='black'>y</c></para>
</cell>
<cell><para><c color='black'>NULL</c></para>
</cell></row><row><cell><para><c color='black'>duty</c></para>
</cell>
<cell><para><c color='black'>technician</c></para>
</cell>
<cell><para><c color='black'>phone</c></para>
</cell>
<cell><para><c color='black'>2363</c></para>
</cell>
<cell><para><c color='black'>faxes</c></para>
</cell>
<cell><para><c color='black'>Null</c></para>
</cell></row><row><cell><para><c color='black'>Family</c><c color='black'> phone</c></para>
</cell>
<cell><para><c color='black'>4189</c></para>
</cell>
<cell><para><c color='black'>E_mail</c></para>
</cell>
<cell><para><c color='black'>[email protected]</c></para>
</cell>
<cell><para><c color='black'>combined set</c></para>
</cell>
<cell><para><c color='black'>000</c></para>
</cell></row><row><cell><para><c color='black'>Address</c></para>
</cell>
<cell><para><c color='black'>Lei</c> <c color='black'>eletricity</c></para>
</cell>
<cell><para><c color='black'>Mail</c></para>
</cell>
<cell><para><c color='black'>421800</c></para>
</cell></row><row><cell><para><c color='black'>¹</c><c color='black'>¤</c><c color='black'>×</c><c color='black'>÷</c><c color='black'>¼</c><c color='black'>ò</c><c color='black'>À</c><c color='black'>ú</c></para>
</cell>
<cell><para><c color='black'>1995-2003 </c><c color='black'>Lei</c> <c color='black'>eletricity</c></para>
</cell></row><row><cell><para><c color='black'>success</c></para>
</cell>
<cell><para></para><para><c color='black'>Null</c></para>
</cell></row><row><cell><para><c color='black'>commend</c> <c color='black'>idea</c></para>
</cell>
<cell><para><c color='black'>Null</c></para>
</cell></row>
</table>
<para></para>
</article>
比如结果是table和para的聚集。table是row的聚集,row是cell的聚集,cell是para的聚集,para是emphasis和c的聚集,etc。
针对这个数据结构再构建相应的方法。可以尝试一下。