<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>Ayas置き場 &#187; Spreadsheet_Excel_Reader</title>
	<atom:link href="http://www.coalice.info/blog/tag/spreadsheet_excel_reader/feed" rel="self" type="application/rss+xml" />
	<link>http://www.coalice.info/blog</link>
	<description>｢個｣を降り積もらせる場所。</description>
	<lastBuildDate>Fri, 03 Sep 2010 05:59:00 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.coalice.info/blog/tag/spreadsheet_excel_reader/feed" />
		<item>
		<title>PHPでExcelファイル操作のまとめ(途中)</title>
		<link>http://www.coalice.info/blog/programming/php/116.html</link>
		<comments>http://www.coalice.info/blog/programming/php/116.html#comments</comments>
		<pubDate>Wed, 26 Dec 2007 00:00:00 +0000</pubDate>
		<dc:creator>Ayas</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHPExcel]]></category>
		<category><![CDATA[Spreadsheet_Excel_Reader]]></category>

		<guid isPermaLink="false">http://www.coalice.info/blog/diary/116.html</guid>
		<description><![CDATA[
　詳細書くのは問題あるので趣味部分のみ。
			
PHPExcel

2007形式に対応している
読み込みはExcel2007(.xlsx)形式のみ(っぽい)
書き出しはExcel5(.xls), Excel2007両 [...]]]></description>
			<content:encoded><![CDATA[<div class="section">
<p>　詳細書くのは問題あるので趣味部分のみ。</p>
<p>			<a name="seemore"></a></p>
<h4>PHPExcel</h4>
<ol>
<li>2007形式に対応している</li>
<li>読み込みはExcel2007(.xlsx)形式のみ(っぽい)</li>
<li>書き出しはExcel5(.xls), Excel2007両方出来る</li>
</ol>
<h4>Spreadsheet_Excel_Reader</h4>
<ol>
<li>Excel5形式からデータを読み込める。2007形式は調べていないので不明。</li>
</ol>
<p>導入に当たって</p>
<blockquote>
<p>Warning: require_once(Spreadsheet/Excel/Reader/OLERead.php)</p>
</blockquote>
<p>　Google先生で散々引いたけど良く解らない。というか、スペイン語のサイトしか出てこない。読めるかー！<span class="footnote"><a href="/Ayas/#f1" name="fn1" title="ヒントは無いかと目だけは通したけど撃沈。">*1</a></span>PEARのSpreadsheet/Excel/Readerの位置なんだけど、そもそもそんなパッケージは無いぞ。同梱のoleread.incをSpreadsheet/Excel/Reader/OLERead.phpとして置いてやれば動くけれども。</p>
<p>　配布しているサイトにも</p>
<blockquote title="http://sourceforge.net/docman/display_doc.php?docid=22092&#38;group_id=99160" cite="http://sourceforge.net/docman/display_doc.php?docid=22092&#038;group_id=99160">
<p>Starting before version 2i, the oleread.inc file is included with the PHP ExcelReader distribution, so it is no longer necessary to have the OLE package available.</p>
<p>			<cite><a href="http://sourceforge.net/docman/display_doc.php?docid=22092&#038;group_id=99160">http://sourceforge.net/docman/display_doc.php?docid=22092&#38;group_id=99160</a></cite></p></blockquote>
<p> と書いてあるから、動くこと自体は不思議じゃないが、こんな胡散臭い方法が正しいとは思えない。。。Webでうろうろしていても、簡単だった！、<a href="http://green0.rdap.jp/" target="_blank">このサイト</a><span class="footnote"><a href="/Ayas/#f2" name="fn2" title="閉鎖っぽい。が、一応内容は見た。">*2</a></span>の通りでできた！、とはあるけど、エラーが出たとは書いてない。なぜだろう。英語の解釈がどこかで間違ってるのだろう、そうだろう。・・・</p>
<p></p>
<p>　使い方自体は簡単で、</p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showPlainTxt('php-2'); return false;">Click to PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span> ‘Spreadsheet/Excel/reader.php‘;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print"><span style="color:#000066;">print</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"&lt;html&gt;&lt;body&gt;"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$xls</span> = <span style="color:#000000; font-weight:bold;">new</span> Spreadsheet_Excel_Reader<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$xls</span>-&gt;&gt;setUTFEncoder<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'mb'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$xls</span>-&gt;<span style="color:#006600;">setOutputEncoding</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'SJIS'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$xls</span>-&gt;<span style="color:#006600;">read</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"test.xls"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$sheet</span> = <span style="color:#CC66CC;color:#800000;">0</span>; <span style="color:#FF9933; font-style:italic;">//シートの1枚目は0から。</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$cols</span> = <span style="color:#CC66CC;color:#800000;">1</span>;　<span style="color:#FF9933; font-style:italic;">//セルの1つ目は1から。</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$rows</span> = <span style="color:#CC66CC;color:#800000;">1</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print"><span style="color:#000066;">print</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$xls</span>-&gt;<span style="color:#006600;">sheets</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$sheet</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"cells"</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$cols</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$rows</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print"><span style="color:#000066;">print</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"&lt;/body&gt;&lt;/html&gt;"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>こうしてやれば、Excelの1番目のシートの、一番左上のセルの内容が読み出せる。</p>
</p></div>
<div class="footnote">
<p class="footnote"><a href="/Ayas/#fn1" name="f1">*1</a>：ヒントは無いかと目だけは通したけど撃沈。</p>
<p class="footnote"><a href="/Ayas/#fn2" name="f2">*2</a>：閉鎖っぽい。が、一応内容は見た。</p>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.coalice.info/blog/programming/php/116.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.coalice.info/blog/programming/php/116.html" />
	</item>
	</channel>
</rss>
