EXCEL export 시 시트 이름 지정하여 여러 시트에 데이터 쓰기 > php

본문 바로가기
사이트 내 전체검색

php

EXCEL export 시 시트 이름 지정하여 여러 시트에 데이터 쓰기

페이지 정보

작성자 서방님 댓글 0건 조회 123회 작성일 13-10-10 14:29

본문

<?
$today=date('Ymd');
$file_name=$today.".xls"; //저장할 파일이름
header( "Content-type: application/octet-stream;charset=KSC5601");
header( "Content-Disposition: attachment; filename=$file_name" );
header("Content-Type: application/ms-excel");
header("Pragma: no-cache");
header("Expires: 0");
//header( "Content-Description: PHP4 Generated Data" );

echo '<?xml version="1.0" encoding="EUC-KR"?>';
?>


<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"> 
 <Worksheet ss:Name="aa">
  <Table>
    <Row>
    <Cell><Data ss:Type="String">a11</Data></Cell>
    <Cell><Data ss:Type="String">a12</Data></Cell>
    <Cell><Data ss:Type="String">a13</Data></Cell>
    </Row>
    <Row>
    <Cell><Data ss:Type="String">a21</Data></Cell>
    <Cell><Data ss:Type="String">a22</Data></Cell>
    <Cell><Data ss:Type="String">a23</Data></Cell>
    </Row>
  </Table>
 </Worksheet>
 <Worksheet ss:Name="bb">
  <Table>
    <Row>
    <Cell><Data ss:Type="String">b11</Data></Cell>
    <Cell><Data ss:Type="String">b12</Data></Cell>
    <Cell><Data ss:Type="String">b13</Data></Cell>
    </Row>
    <Row>
    <Cell><Data ss:Type="String">b21</Data></Cell>
    <Cell><Data ss:Type="String">b22</Data></Cell>
    <Cell><Data ss:Type="String">b23</Data></Cell>
    </Row>
  </Table>
 </Worksheet>
</Workbook>

댓글목록

등록된 댓글이 없습니다.

Total 612건 24 페이지
게시물 검색

회원로그인

접속자집계

오늘
236
어제
225
최대
1,347
전체
154,995
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.