Topic: [REQ]如何用JAVA将Excel转化成HTML

  Print this page

1.[REQ]如何用JAVA将Excel转化成HTML Copy to clipboard
Posted by: ditty
Posted on: 2005-09-07 12:23

最近遇到一个问题,就是将Excel转换成HTML,就像Excel的另存功能。
那位兄弟用过,帮帮忙。Big Smile

2.Re:[REQ]如何用JAVA将Excel转化成HTML [Re: ditty] Copy to clipboard
Posted by: ken0719
Posted on: 2005-09-07 14:58

There is an open source project POI, It's proved Java API to access microsoft formate files (including excel).

3.Re:[REQ]如何用JAVA将Excel转化成HTML [Re: ken0719] Copy to clipboard
Posted by: ditty
Posted on: 2005-09-07 15:20

你可能没有明白我的问题,用POI操作Excel是没问题的,现在我希望能将一个Excel输出(或转换)成HTML格式的文件,有点类似Microsoft Excel的另存功能。

4.Re:[REQ]如何用JAVA将Excel转化成HTML [Re: ditty] Copy to clipboard
Posted by: ken0719
Posted on: 2005-09-08 12:00

Maybe there are two ways to converse a excel to a html file:
1: Use JNI, make a .dll file with VB to open and sava a excel file to html format
This is the vbscript code:

Sub Macro1()
Workbooks.Open Filename:="D:\wcap\doc\Test Report R1.0.xls"
ActiveWorkbook.SaveAs Filename:="D:\wcap\doc\Test Report R1.0.htm", _
FileFormat:=xlHtml, ReadOnlyRecommended:=False, CreateBackup:=False
End Sub

2. Use POI, write a tool by yourself, read the content and other informations from an excel file then output to a html file and format it.
The second implemention is more complex, and in my idea the first solution is better but .dll only work in Windows.
Welcome to other solutions.

5.Re:[REQ]如何用JAVA将Excel转化成HTML [Re: ken0719] Copy to clipboard
Posted by: ditty
Posted on: 2005-09-09 14:08

ken0719 wrote:
Maybe there are two ways to converse a excel to a html file:
1: Use JNI, make a .dll file with VB to open and sava a excel file to html format
This is the vbscript code:

Sub Macro1()
Workbooks.Open Filename:="D:\wcap\doc\Test Report R1.0.xls"
ActiveWorkbook.SaveAs Filename:="D:\wcap\doc\Test Report R1.0.htm", _
FileFormat:=xlHtml, ReadOnlyRecommended:=False, CreateBackup:=False
End Sub

2. Use POI, write a tool by yourself, read the content and other informations from an excel file then output to a html file and format it.
The second implemention is more complex, and in my idea the first solution is better but .dll only work in Windows.
Welcome to other solutions.


thanks a lot.Big Smile

6.Re:[REQ]如何用JAVA将Excel转化成HTML [Re: ditty] Copy to clipboard
Posted by: zcjl
Posted on: 2005-09-09 16:35

http://www.andykhan.com/jexcelapi/index.html

这个工具似乎也可以操作excel文件

7.Re:[REQ]如何用JAVA将Excel转化成HTML [Re: zcjl] Copy to clipboard
Posted by: ditty
Posted on: 2005-09-09 18:41

zcjl wrote:
http://www.andykhan.com/jexcelapi/index.html

这个工具似乎也可以操作excel文件

not found availabe interface.Sad

8.Re:[REQ]如何用JAVA将Excel转化成HTML [Re: ditty] Copy to clipboard
Posted by: zcjl
Posted on: 2005-09-09 21:38

ditty wrote:
not found availabe interface.:(


sorry, I didn't notice that the URL is not available now
you can get it at http://jexcelapi.sourceforge.net/

9.Re:[REQ]如何用JAVA将Excel转化成HTML [Re: ditty] Copy to clipboard
Posted by: hurui33
Posted on: 2005-09-13 15:00

个人认为需要通过能够访问MS Excel的package(如POI和JExcelApi)读取数据,自己写转换为html的程序,

10.Re:[REQ]如何用JAVA将Excel转化成HTML [Re: hurui33] Copy to clipboard
Posted by: ditty
Posted on: 2005-09-14 10:22

hurui33 wrote:
个人认为需要通过能够访问MS Excel的package(如POI和JExcelApi)读取数据,自己写转换为html的程序,

突然想起,OpenOffice也许有类似功能,可以借鉴一下。

11.Re:[REQ]如何用JAVA将Excel转化成HTML [Re: ditty] Copy to clipboard
Posted by: javadd
Posted on: 2005-09-14 15:18

jxl可以,将excel读取出一个二维数组,取出excel上每个单元格的数据类型,再打印在HTML表格上,jxl在取excel里数据做得挺好的.

我用过它写过完整的 导入&导出 Excel的程序.

jxl导出excel,在格式设置(比如中文字体,高度设置)稍弱些.

我希望以后做导出 Excel用jni调用COM那个api来做,可能会更好些.

12.Re:[REQ]如何用JAVA将Excel转化成HTML [Re: javadd] Copy to clipboard
Posted by: ditty
Posted on: 2005-09-14 18:28

导出Excel已经相对成熟,也不是咱们要讨论的主要内容。
但是,对于一个已经存在的Excel,若将其转换成其他各式,目前尚无可行的方案,而对于JNI调用,也局限于windows操作系统,唉,我已经基本放弃这种想法了。

13.Re:[REQ]如何用JAVA将Excel转化成HTML [Re: ditty] Copy to clipboard
Posted by: chaor
Posted on: 2005-09-17 14:44

我做过,用的就是jexcelapi,不过现在源码不知放哪儿去了,我找找.可以比较完美的将excel转为html.包括单元格合并什么的都没问题


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923