PHP導出XML格式的EXCEL

<?php function Export(){ set_time_limit(0); ob_start(); $biz = new ZaikuBiz(); $biz->setSearch($_POST); $list = $biz->loadAll(); $this->setVar('list', $list); $this->setVar('ExpandedRowCount', count($list)+1); $this->startDownload('在庫_'.date('Ymd').'.xls'); echo "<?xml version=\"1.0\"?>\r\n"; echo "<?mso-application progid=\"Excel.Sheet\"?>\r\n"; $this->loadFile('Zaiku/Export'); } ?>

 

 

<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
 <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  <Author>Windows 用戶</Author>
  <LastAuthor>Windows 用戶</LastAuthor>
  <Created>2017-03-15T04:33:02Z</Created>
  <LastSaved>2017-03-15T04:34:31Z</LastSaved>
  <Version>12.00</Version>
 </DocumentProperties>
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>5970</WindowHeight>
  <WindowWidth>15015</WindowWidth>
  <WindowTopX>480</WindowTopX>
  <WindowTopY>60</WindowTopY>
  <ProtectStructure>False</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
 </ExcelWorkbook>
 <Styles>
  <Style ss:ID="Default" ss:Name="Normal">
   <Alignment ss:Vertical="Center"/>
   <Borders/>
   <Font ss:FontName="宋體" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
   <Interior/>
   <NumberFormat/>
   <Protection/>
  </Style>
 </Styles>
 <Worksheet ss:Name="Sheet1">
  <Table ss:ExpandedColumnCount="6" ss:ExpandedRowCount="{ExpandedRowCount}" x:FullColumns="1" x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="13.5">
   <Row>
    <Cell><Data ss:Type="String">規格型號</Data></Cell>
    <Cell><Data ss:Type="String">產品編號</Data></Cell>
    <Cell><Data ss:Type="String">描述</Data></Cell>
    <Cell><Data ss:Type="String">入庫數量</Data></Cell>
    <Cell><Data ss:Type="String">出庫數量</Data></Cell>
    <Cell><Data ss:Type="String">當前在庫</Data></Cell>
   </Row>
   <tpl:loop name="list">
   <Row>
    <Cell><Data ss:Type="String">{spec}</Data></Cell>
    <Cell><Data ss:Type="String">{no}</Data></Cell>
    <Cell><Data ss:Type="String">{desc}</Data></Cell>
    <Cell><Data ss:Type="Number">{in_number}</Data></Cell>
    <Cell><Data ss:Type="Number">{out_number}</Data></Cell>
    <Cell><Data ss:Type="Number">{stock_number}</Data></Cell>
   </Row>
   </tpl:loop>
  </Table>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <PageSetup>
    <Header x:Margin="0.3"/>
    <Footer x:Margin="0.3"/>
    <PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
   </PageSetup>
   <Selected/>
   <Panes>
    <Pane>
     <Number>3</Number>
     <ActiveRow>4</ActiveRow>
     <ActiveCol>5</ActiveCol>
    </Pane>
   </Panes>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
</Workbook>
相關文章
相關標籤/搜索