急帖:请问如何用java将excel表展示成html形式,并且格式不变????????
一句话:如何将excel完整地转化成html形式,转化后页面中的格式也和原先一致 问题点数:60、回复次数:4Top
1 楼wansai00(天紫)回复于 2005-06-15 00:09:33 得分 60
建立EXCEL对象的方法
var ExcelSheet;
ExcelApp = new ActiveXObject("Excel.Application");
ExcelSheet = new ActiveXObject("Excel.Sheet");
// 使 Excel 通过 Application 对象可见。
ExcelSheet.Application.Visible = true;
// 将一些文本放置到表格的第一格中。
ExcelSheet.ActiveSheet.Cells(1,1).Value = "This is column A, row 1";
// 保存表格。
ExcelSheet.SaveAs("C:\\TEST.XLS");
// 用 Application 对象用 Quit 方法关闭 Excel。
ExcelSheet.Application.Quit();
Top
2 楼wansai00(天紫)回复于 2005-06-15 00:13:07 得分 0
读取EXCEL
var cn = new ActiveXObject("ADODB.Connection")
cn.Provider = "Microsoft.Jet.OLEDB.4.0 "
cn.ConnectionString = "Data Source=" & Server.MapPath("data.xls") & ";Extended Properties=Excel 8.0;"
cn.Open()
var rsRead=new ActiveXObject("ADODB.Recordset")
rsRead.Open("select * from [Sheet1$]",cn,1,1)Top
3 楼wansai00(天紫)回复于 2005-06-15 00:16:04 得分 0
用HTML写出一个WEB下的EXCEL界面
<OBJECT id=Spreadsheet1 codeBase=file:\Bobsoftwareoffice2000msowc.cab height=250 width="100%" classid=clsid:0002E510-0000-0000-C000-000000000046><PARAM NAME="HTMLURL" VALUE="">
<PARAM NAME="HTMLData" VALUE="<html xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"> <head> <style type="text/css"> <!--tr 	{mso-height-source:auto;} td 	{white-space:nowrap;} .wcC8902D9 	{white-space:nowrap; 	font-family:宋体; 	mso-number-format:General; 	font-size:auto; 	font-weight:auto; 	font-style:auto; 	text-decoration:auto; 	mso-background-source:auto; 	mso-pattern:auto; 	mso-color-source:auto; 	text-align:general; 	vertical-align:bottom; 	border-top:none; 	border-left:none; 	border-right:none; 	border-bottom:none; 	mso-protection:locked;} --> </style> </head> <body> <!--[if gte mso 9]><xml> <x:ExcelWorkbook> <x:ExcelWorksheets> <x:ExcelWorksheet> <x:OWCVersion>9.0.0.6430</x:OWCVersion> <x:Label Style='border-top:solid .5pt silver;border-left:solid .5pt silver; border-right:solid .5pt silver;border-bottom:solid .5pt silver'> <x:Caption>Microsoft Office Spreadsheet</x:Caption> </x:Label> <x:Name>Sheet1</x:Name> <x:WorksheetOptions> <x:Selected/> <x:Height>6615</x:Height> <x:Width>14023</x:Width> <x:TopRowVisible>0</x:TopRowVisible> <x:LeftColumnVisible>0</x:LeftColumnVisible> <x:ProtectContents>False</x:ProtectContents> <x:DefaultRowHeight>210</x:DefaultRowHeight> <x:StandardWidth>2389</x:StandardWidth> </x:WorksheetOptions> </x:ExcelWorksheet> </x:ExcelWorksheets> <x:MaxHeight>80%</x:MaxHeight> <x:MaxWidth>80%</x:MaxWidth> </x:ExcelWorkbook> </xml><![endif]--> <table class=wcC8902D9 x:str> <col width="56"> <tr height="14"> <td></td> </tr> </table> </body> </html> ">
<PARAM NAME="DataType" VALUE="HTMLDATA">
<PARAM NAME="AutoFit" VALUE="0">
<PARAM NAME="DisplayColHeaders" VALUE="-1">
<PARAM NAME="DisplayGridlines" VALUE="-1">
<PARAM NAME="DisplayHorizontalScrollBar" VALUE="-1">
<PARAM NAME="DisplayRowHeaders" VALUE="-1">
<PARAM NAME="DisplayTitleBar" VALUE="-1">
<PARAM NAME="DisplayToolbar" VALUE="-1">
<PARAM NAME="DisplayVerticalScrollBar" VALUE="-1">
<PARAM NAME="EnableAutoCalculate" VALUE="-1">
<PARAM NAME="EnableEvents" VALUE="-1">
<PARAM NAME="MoveAfterReturn" VALUE="-1">
<PARAM NAME="MoveAfterReturnDirection" VALUE="0">
<PARAM NAME="RightToLeft" VALUE="0">
<PARAM NAME="ViewableRange" VALUE="1:65536">
</OBJECT>Top
4 楼terryzyl(terry)回复于 2005-06-15 01:34:22 得分 0
该如何用java实现阿?
ExcelSheet是什么东西?Top




