当前位置: 技术问答>java相关
在java或jsp中,如何将web页上表格中的数据导入到excel中?多谢了,一定给分,希望直接给程序,不要写连接,因为我现在上望不方便
来源: 互联网 发布时间:2015-04-10
本文导语: | 虽然你不想看连接,但是还是给你一个连接:http://www.alphaworks.ibm.com/alphabeans 到这里下载一个ExcelAccessor 这样你就可以在java里面直接操作excel文件,而不是使用逗号分割文件。 试试看吧! | 按格...
|
虽然你不想看连接,但是还是给你一个连接:http://www.alphaworks.ibm.com/alphabeans
到这里下载一个ExcelAccessor
这样你就可以在java里面直接操作excel文件,而不是使用逗号分割文件。
试试看吧!
到这里下载一个ExcelAccessor
这样你就可以在java里面直接操作excel文件,而不是使用逗号分割文件。
试试看吧!
|
按格式符号分隔数据项为一行一条记录,按文本导入EXCEL里。
|
不显示applet的问题,你可以到sun去下载一个htmlconv,用它进行转换后就行了。
|
其实skyyoung(路人甲)已经说了,程序你可以参考我在原先那一帖给你的ASP程序。怎么还要到处去问???????
|
SORRY,那个人不是你,你是流浪少年吧?好久不见,还记得我吗?
我在这里再贴一次这个ASP程序吧,可以运行的,我试过。
将数据库里面的内容生成EXCEL
1、ASP文件:
2、数据库相关:
CREATE TABLE [populationperhour] (
[population] [int] NOT NULL ,
[hourpos] [int] NOT NULL ,
[datepos] [datetime] NOT NULL
);
insert into populationperhour values('936','1','2001-1-11');
insert into populationperhour values('636','2','2001-1-11');
insert into populationperhour values('106','3','2001-1-11');
insert into populationperhour values('177','4','2001-1-11');
insert into populationperhour values('140','5','2001-1-11');
insert into populationperhour values('114','6','2001-1-11');
insert into populationperhour values('94','7','2001-1-11');
insert into populationperhour values('49','8','2001-1-11');
insert into populationperhour values('88','9','2001-1-11');
insert into populationperhour values('215','10','2001-1-11');
insert into populationperhour values('370','11','2001-1-11');
insert into populationperhour values('550','12','2001-1-11');
insert into populationperhour values('629','13','2001-1-11');
insert into populationperhour values('756','14','2001-1-11');
insert into populationperhour values('833','15','2001-1-11');
insert into populationperhour values('923','16','2001-1-11');
insert into populationperhour values('980','17','2001-1-11');
insert into populationperhour values('957','18','2001-1-11');
insert into populationperhour values('812','19','2001-1-11');
insert into populationperhour values('952','20','2001-1-11');
insert into populationperhour values('1379','21','2001-1-11');
insert into populationperhour values('1516','22','2001-1-11');
insert into populationperhour values('1476','23','2001-1-11');
insert into populationperhour values('1291','24','2001-1-11');
insert into populationperhour values('1028','1','2001-1-12');
insert into populationperhour values('687','2','2001-1-12');
insert into populationperhour values('462','3','2001-1-12');
insert into populationperhour values('317','4','2001-1-12');
insert into populationperhour values('221','5','2001-1-12');
insert into populationperhour values('158','6','2001-1-12');
insert into populationperhour values('127','7','2001-1-12');
insert into populationperhour values('81','8','2001-1-12');
insert into populationperhour values('96','9','2001-1-12');
insert into populationperhour values('192','10','2001-1-12');
insert into populationperhour values('380','11','2001-1-12');
insert into populationperhour values('629','12','2001-1-12');
insert into populationperhour values('745','13','2001-1-12');
insert into populationperhour values('964','14','2001-1-12');
insert into populationperhour values('1012','15','2001-1-12');
insert into populationperhour values('1050','16','2001-1-12');
insert into populationperhour values('1135','17','2001-1-12');
insert into populationperhour values('1130','18','2001-1-12');
insert into populationperhour values('894','19','2001-1-12');
insert into populationperhour values('1026','20','2001-1-12');
insert into populationperhour values('1430','21','2001-1-12');
insert into populationperhour values('1777','22','2001-1-12');
insert into populationperhour values('1759','23','2001-1-12');
insert into populationperhour values('1697','24','2001-1-12');
我在这里再贴一次这个ASP程序吧,可以运行的,我试过。
将数据库里面的内容生成EXCEL
1、ASP文件:
2、数据库相关:
CREATE TABLE [populationperhour] (
[population] [int] NOT NULL ,
[hourpos] [int] NOT NULL ,
[datepos] [datetime] NOT NULL
);
insert into populationperhour values('936','1','2001-1-11');
insert into populationperhour values('636','2','2001-1-11');
insert into populationperhour values('106','3','2001-1-11');
insert into populationperhour values('177','4','2001-1-11');
insert into populationperhour values('140','5','2001-1-11');
insert into populationperhour values('114','6','2001-1-11');
insert into populationperhour values('94','7','2001-1-11');
insert into populationperhour values('49','8','2001-1-11');
insert into populationperhour values('88','9','2001-1-11');
insert into populationperhour values('215','10','2001-1-11');
insert into populationperhour values('370','11','2001-1-11');
insert into populationperhour values('550','12','2001-1-11');
insert into populationperhour values('629','13','2001-1-11');
insert into populationperhour values('756','14','2001-1-11');
insert into populationperhour values('833','15','2001-1-11');
insert into populationperhour values('923','16','2001-1-11');
insert into populationperhour values('980','17','2001-1-11');
insert into populationperhour values('957','18','2001-1-11');
insert into populationperhour values('812','19','2001-1-11');
insert into populationperhour values('952','20','2001-1-11');
insert into populationperhour values('1379','21','2001-1-11');
insert into populationperhour values('1516','22','2001-1-11');
insert into populationperhour values('1476','23','2001-1-11');
insert into populationperhour values('1291','24','2001-1-11');
insert into populationperhour values('1028','1','2001-1-12');
insert into populationperhour values('687','2','2001-1-12');
insert into populationperhour values('462','3','2001-1-12');
insert into populationperhour values('317','4','2001-1-12');
insert into populationperhour values('221','5','2001-1-12');
insert into populationperhour values('158','6','2001-1-12');
insert into populationperhour values('127','7','2001-1-12');
insert into populationperhour values('81','8','2001-1-12');
insert into populationperhour values('96','9','2001-1-12');
insert into populationperhour values('192','10','2001-1-12');
insert into populationperhour values('380','11','2001-1-12');
insert into populationperhour values('629','12','2001-1-12');
insert into populationperhour values('745','13','2001-1-12');
insert into populationperhour values('964','14','2001-1-12');
insert into populationperhour values('1012','15','2001-1-12');
insert into populationperhour values('1050','16','2001-1-12');
insert into populationperhour values('1135','17','2001-1-12');
insert into populationperhour values('1130','18','2001-1-12');
insert into populationperhour values('894','19','2001-1-12');
insert into populationperhour values('1026','20','2001-1-12');
insert into populationperhour values('1430','21','2001-1-12');
insert into populationperhour values('1777','22','2001-1-12');
insert into populationperhour values('1759','23','2001-1-12');
insert into populationperhour values('1697','24','2001-1-12');
|
我近来一直在JAVA版混,很少去JSP版了;你好象也在忙着找房子吧?当然很少见面了。
|
ASP当然可以改写成JSP了,其实程序的关键在
Do while Not rs.EOF
strLine=""
for each x in rs.Fields
strLine= strLine & x.value & chr(9)
next
'--将表的数据写入EXCEL
myfile.writeline strLine
rs.MoveNext
loop
你把它改成JSP就行了。这个你应该会改吧?
怎样才能使插件有效?呵呵,好象要看具体的插件吧,我也没有用具体过。如果你的applet是继承自Applet的,可以不用插件的;如果是继承自JApplet,因为IE不支持到SWING组件,需要插件。就是用htmlconv,其实就是改成一个标签。
Do while Not rs.EOF
strLine=""
for each x in rs.Fields
strLine= strLine & x.value & chr(9)
next
'--将表的数据写入EXCEL
myfile.writeline strLine
rs.MoveNext
loop
你把它改成JSP就行了。这个你应该会改吧?
怎样才能使插件有效?呵呵,好象要看具体的插件吧,我也没有用具体过。如果你的applet是继承自Applet的,可以不用插件的;如果是继承自JApplet,因为IE不支持到SWING组件,需要插件。就是用htmlconv,其实就是改成一个标签。
|
lci21(流浪少年)兄:不好意思,我没有看清楚你的要求,上面的程序是不能满足你的要求的。我想你应该自己分析里的各个元素,然后再生成excel文件。或者干脆把数据库里的内容以excel的形式显示在IE浏览器上。不知道你以为如何?