• 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"?>
    ";
        echo "<?mso-application progid="Excel.Sheet"?>
    ";
        $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>
  • 相关阅读:
    ES6之6种遍历对象属性的方法
    css自定义滚动条样式,自定义文字选择样式,设置文字不被选择
    js img转换base64
    移动端rem造成的很多问题
    移动端边框1像素的问题
    【小练习1】如何制作“表单”
    2015-09-24 第六节课 (CSS补充和html 标签讲解、浏览器兼容性)
    2015-09-22 第四节课 CSS块级元素 行内元素 浮动 盒子模型 绝对定位、相当定位和固定定位
    2015-09-21 第三节课 css属性 border(边框)、background(背景)
    html你可能还不知道的一些知识点
  • 原文地址:https://www.cnblogs.com/coffee_cn/p/10832473.html
Copyright © 2020-2023  润新知