엑셀(*.xls) 화일을 PHP에서 읽기 > php

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

php

엑셀(*.xls) 화일을 PHP에서 읽기

페이지 정보

작성자 서방님 댓글 0건 조회 133회 작성일 11-07-08 09:34

본문

1. http://sourceforge.net/projects/phpexcelreader/ 에서 Spreadsheet_Excel_Reader를 다운 받습니다.
2. 소스를 보면 사용법은 그냥 알 수 있습니다.
3. 한글처리가 안되는 문제도 쉽게 발견할 수 있습니다.
4. 아래와 같이 사용하면 한글도 처리가 됩니다.

<?
require_once 'Excel/reader.php';
$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('CP949'); // 이부분만 바꿨습니다.
$data->read('kortest.xls');

error_reporting(E_ALL ^ E_NOTICE);
echo "<table border=1>";
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
       echo "<tr>";
       for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++) {
              echo "<td>&nbsp;".$data->sheets[0]['cells'][$i][$j]."</td>";
       }
       echo "</tr>\n";
}
echo "</table>";
?>

댓글목록

등록된 댓글이 없습니다.

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

회원로그인

접속자집계

오늘
282
어제
225
최대
1,347
전체
155,041
Latest Crypto Fear & Greed Index

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