Excel导出xml文件,怎么在HTML中加载为table

Excel导出xml文件,如何在HTML中加载为table
本帖最后由 a137151062 于 2014-09-02 20:13:08 编辑
  最近有一个需求,页面有很多表格。这些表格的样式很难处理,而通过Excel来画出来却很容易。想到一个思路是将Excel导出为xml格式的文件,然后在html中加载该文件,并让其显示与Excel模板一致。如何做,请大神赐教...
举例:
  这是在Excel中的模板
  Excel导出xml文件,怎么在HTML中加载为table
  导出的xml格式为下面的格式
    xmlns:html="http://www.w3.org/TR/REC-html40">
 <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  <Created>2006-09-16T00:00:00Z</Created>
  <LastSaved>2014-09-02T03:24:47Z</LastSaved>
  <Version>14.00</Version>
 </DocumentProperties>
 <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
  <AllowPNG/>
  <RemovePersonalInformation/>
 </OfficeDocumentSettings>
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>8010</WindowHeight>
  <WindowWidth>14805</WindowWidth>
  <WindowTopX>240</WindowTopX>
  <WindowTopY>105</WindowTopY>
  <ProtectStructure>False</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
 </ExcelWorkbook>
 <Styles>
  <Style ss:ID="s76" ss:Parent="s62">
   <Borders>
    <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
    <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
    <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
    <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
   </Borders>
   <Font ss:FontName="宋体" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
   <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
  </Style>
 </Styles>
 <Worksheet ss:Name="Sheet1">
  <Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="30" x:FullColumns="1"
   x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="13.5">
   <Row ss:Height="14.25">
    <Cell ss:StyleID="s63"><Data ss:Type="String">单位:</Data></Cell>
    <Cell ss:StyleID="s63"/>
    <Cell ss:StyleID="s65"><Data ss:Type="String">代理商代码:</Data></Cell>
    <Cell ss:StyleID="s66"/>
    <Cell ss:StyleID="s67"><Data ss:Type="String">订单日期</Data><Comment
      ss:Author="作者"><ss:Data xmlns="http://www.w3.org/TR/REC-html40"><B><Font
         html:Size="10" html:Color="#000000">作者:</Font></B><Font html:Size="10"
        html:Color="#000000">&#10;(系统自动生成填写当天日期)</Font></ss:Data></Comment></Cell>
    <Cell ss:MergeAcross="1" ss:StyleID="m40337120"/>
   </Row>
   <Row ss:Height="14.25">
    <Cell ss:MergeAcross="1" ss:StyleID="m40337140"><Data ss:Type="String">转库凭证号:</Data></Cell>
    <Cell ss:StyleID="s65"/>
    <Cell ss:StyleID="s66"/>
    <Cell ss:MergeAcross="2" ss:StyleID="m40337160"><Data ss:Type="String">NO.(系统自动生成)</Data></Cell>
   </Row>
   <Row ss:Height="14.25">
    <Cell ss:StyleID="s75"><Data ss:Type="String">序号</Data></Cell>
    <Cell ss:StyleID="s75"><Data ss:Type="String">物料编码</Data></Cell>
    <Cell ss:StyleID="s75"><Data ss:Type="String">产品名称(物料描述)</Data></Cell>
    <Cell ss:StyleID="s75"><Data ss:Type="String">数量</Data></Cell>
    <Cell ss:StyleID="s75"><Data ss:Type="String">金额</Data></Cell>
    <Cell ss:StyleID="s75"><Data ss:Type="String">发货日期</Data></Cell>
    <Cell ss:StyleID="s75"><Data ss:Type="String">单据编号</Data></Cell>
   </Row>
如何通过这xml在html中显示上图的样式。
------解决思路----------------------
你这不是蛋疼吗,你既然能导出XML,为什么不直接把EXCEL导出HTML呢?
------解决思路----------------------
,可以使用js的execCommand("paste")方法,来获取你复制excel时,放在剪贴板中的数据,然后用js的$(“#dom元素的id”).html(获取的数据);