把数据库查询信息直接生成网页嵌入EXCEL表的格式,并可导出成EXC

80酷酷网    80kuku.com

  excel|数据|数据库|网页看了精华区中众多处理EXCEL的贴子,好象没有人写这种操作方法,我把我做过的写出来给大家参考一下。

1、先在FrongPage中新建一个网页,在网页中插入一个EXCEL组件(插入-WEB组件-EXCEL电子表格),然后把你要输出的数据格式输入该嵌入的EXCEL表格中,在组件中点右键-属性,可定义该组件的各部分定义项,做好后,查看源代码,得到该嵌入组件的源代码。

2、在VID中新建一ASP网页,复制上步骤中的源代码,然后针对数据列加入循环取数代码。如下:
<object classid="clsid:0002E510-0000-0000-C000-000000000046" id="Spreadsheet1" codebase="msowc.cab" width="599" height="490">
  <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:userset;}
td
    {white-space:nowrap;}
.wc80A6909
    {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;}
.wc01F2F7A
    {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;}
.wc0EA6F7A
    {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:center;
    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.2710</x:OWCVersion>
    <x:Label .5pt silver;border-left:
     solid .5pt silver;border-right:solid .5pt silver;border-bottom:solid .5pt silver'>
     <x:Caption>返工处理日报表-产成品出入库报表-<%=trim(rs_stock("fname"))%>(<%=sdate%>至<%=edate%>)</x:Caption>
    </x:Label>
    <x:Name>Sheet1</x:Name>
    <x:WorksheetOptions>
     <x:Selected/>
     <x:Height>12965</x:Height>
     <x:Width>13996</x:Width>
     <x:TopRowVisible>0</x:TopRowVisible>
     <x:LeftColumnVisible>0</x:LeftColumnVisible>
     <x:ProtectContents>False</x:ProtectContents>
     <x:DefaultRowHeight>315</x:DefaultRowHeight>
     <x:StandardWi

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: