谢少龙

专业不够,技术来凑

PHP excel模板

把模板保存为xls


<?php echo '<?xml version="1.0"?>';?>

<?php echo '<?mso-application progid="Excel.Sheet"?>';?>
<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">
  <Version>12.00</Version>
 </DocumentProperties>
 <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
  <DownloadComponents/>
  <RemovePersonalInformation/>
 </OfficeDocumentSettings>
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>4530</WindowHeight>
  <WindowWidth>8505</WindowWidth>
  <WindowTopX>480</WindowTopX>
  <WindowTopY>120</WindowTopY>
  <ProtectStructure>False</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
 </ExcelWorkbook>
 <Styles>
  <Style ss:ID="Default" ss:Name="Normal">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font ss:FontName="宋体" x:CharSet="134"/>
   <Interior/>
   <NumberFormat/>
   <Protection/>
  </Style>
  <Style ss:ID="s62">
   <Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
   <Font ss:FontName="宋体" x:CharSet="134" ss:Color="#FFFFFF"/>
   <Interior ss:Color="#333399" ss:Pattern="Solid"/>
  </Style>
  <Style ss:ID="s65">
   <NumberFormat ss:Format="#,##0.00_ "/>
  </Style>
  <Style ss:ID="s67">
   <Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
  </Style>
  <Style ss:ID="s68">
   <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>
  </Style>


  <Style ss:ID="s69">
   <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>
   <NumberFormat ss:Format="#,##0.00_ "/>
  </Style>


  <Style ss:ID="s72">
   <Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
   <Font ss:FontName="宋体" x:CharSet="134" ss:Size="18"/>
  </Style>
 </Styles>
 <Worksheet ss:Name="Sheet1">
  <Table ss:ExpandedRowCount="99999" x:FullColumns="1"
   x:FullRows="1" ss:DefaultColumnWidth="120" ss:DefaultRowHeight="18">
   <Column ss:AutoFitWidth="0"/>
   <Column ss:AutoFitWidth="0" />
   <Column ss:AutoFitWidth="0" />
   <Column ss:AutoFitWidth="0" />


   <Row ss:AutoFitHeight="0" ss:Height="28">
    <Cell ss:MergeAcross="5" ss:StyleID="s72"><Data ss:Type="String">详细消费记录</Data></Cell>
   </Row>
   
   <Row ss:AutoFitHeight="0">
    <Cell><Data ss:Type="String">开始时间:</Data></Cell>
    <Cell><Data ss:Type="String"><?php echo $startDay;?></Data></Cell>
    <Cell><Data ss:Type="String">结束时间:</Data></Cell>
    <Cell><Data ss:Type="String"><?php echo $endDay;?></Data></Cell>
   </Row>
   
   <Row ss:AutoFitHeight="0">
    <Cell ss:StyleID="s62"><Data ss:Type="String">消费时间</Data></Cell>
    <Cell ss:StyleID="s62"><Data ss:Type="String">用户名</Data></Cell>
    <Cell ss:StyleID="s62"><Data ss:Type="String">国籍</Data></Cell>
    <Cell ss:StyleID="s62"><Data ss:Type="String">金额(元)</Data></Cell>
   </Row>


   <?php foreach($dataList as $vo){?>
   <Row ss:AutoFitHeight="0">
    <Cell ss:StyleID="s68"><Data ss:Type="String"><?php echo date('Y-m-d H:i:s', $vo['time']);?></Data></Cell>
    <Cell ss:StyleID="s68"><Data ss:Type="String"><?php echo $vo['name'];?></Data></Cell>
    <Cell ss:StyleID="s69"><Data ss:Type="String" ><?php echo $vo['value'];?></Data></Cell>
    <Cell ss:StyleID="s69"><Data ss:Type="String" ><?php echo $vo['coin'];?></Data></Cell>
  </Row>
   <?php }?>
  </Table>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <Unsynced/>
   <Selected/>
   <Panes>
    <Pane>
     <Number>3</Number>
     <ActiveRow>1</ActiveRow>
     <ActiveCol>1</ActiveCol>
    </Pane>
   </Panes>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>

</Workbook>

阅读更多
文章标签: excel模板 php
上一篇php生成csv文件
下一篇Excel制作+导出
想对作者说点什么? 我来说一句

php 导出excel php导入excel

2011年02月11日 903B 下载

Excel模板Excel模板

2012年09月12日 404KB 下载

没有更多推荐了,返回首页

关闭
关闭