2008년 3월 31일 월요일

xls문서 html로 저장

내용은 html이고 확장자는 xls인 경우.
html2xls.pl 에서 바이너리로 변경이 가능 함. sheet명, 색상등을 셋팅할 수 있음

<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
헤더 설정
<head>
<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">
<xml>
<x:ExcelWorkbook>
  <x:ExcelWorksheets>
  <x:ExcelWorksheet>
   <x:Name>Sheet1</x:Name>
   <x:WorksheetOptions>
    <x:Selected/>
   </x:WorksheetOptions>
  </x:ExcelWorksheet>
  </x:ExcelWorksheets>
</x:ExcelWorkbook>
</xml>
</head>
utf-8 로 줄 경우 text editor에서는 깨져 보이지만 실제 excel로 열면 잘 열린다.
특수 문자나 오류를 줄일 수 있기 때문에 utf-8이 최근 선호 되고 있다.

<tr>
                  <td style='mso-number-format:\"\@\"'>$show_date</td>
                  <td style='mso-number-format:\"\@\"'>$supply_name</td>
                  <td style='mso-number-format:\"\@\"'>[묶음]$data_packed[product_id]</td>
                  <td style='mso-number-format:\"\@\"'>$data_packed[name]</td>
                  <td style='mso-number-format:\"\@\"'>$data_packed[brand]</td>
                  <td style='mso-number-format:\"\@\"'>$data_packed[options]</td>
                  <td style='mso-number-format:\"\@\"'>&nbsp;</td>
                  <td style='mso-number-format:\"\@\"'>$list[qty]</td>
                </tr>
내용은 위와 같은 식으로 오면 됨. mso-number-format으로 스타일 지정





댓글 없음:

댓글 쓰기