<?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/"
	>

<channel>
	<title>The Scott Preston Blog &#187; PHP</title>
	<atom:link href="http://www.scottpreston.com/articles/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.scottpreston.com</link>
	<description>Rambles about computing and other things in Columbus, Ohio.</description>
	<lastBuildDate>Wed, 16 May 2012 03:49:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Managing Office Douments with PHP</title>
		<link>http://www.scottpreston.com/articles/615.php</link>
		<comments>http://www.scottpreston.com/articles/615.php#comments</comments>
		<pubDate>Thu, 31 Jan 2008 15:59:15 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[office]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://codegin.com/2008/01/31/managing-office-douments-with-php/</guid>
		<description><![CDATA[I decided to write a class to manage office documents with PHP. Word: function write_word() { $word = new COM("word.application"); $word-&#62;Visible = 0; $word-&#62;Documents-&#62;Add(); $word-&#62;Selection-&#62;PageSetup-&#62;LeftMargin = '2"'; $word-&#62;Selection-&#62;PageSetup-&#62;RightMargin = '2"'; //Setup the font $word-&#62;Selection-&#62;Font-&#62;Name = 'Verdana'; $word-&#62;Selection-&#62;Font-&#62;Size = 8; //Write some text $word-&#62;Selection-&#62;TypeText("This is a test document"); //Insert an image $word-&#62;Selection-&#62;InlineShapes-&#62;addPicture("C:\\temp\\test.png"); //Save the document as [...]]]></description>
			<content:encoded><![CDATA[<p>I decided to write a class to manage office documents with PHP.</p>
<p>Word:</p>
<pre style="height: 200px">
function write_word() {
	$word = new COM("word.application");
	$word-&gt;Visible = 0;
	$word-&gt;Documents-&gt;Add();
	$word-&gt;Selection-&gt;PageSetup-&gt;LeftMargin = '2"';
	$word-&gt;Selection-&gt;PageSetup-&gt;RightMargin = '2"';

	//Setup the font
	$word-&gt;Selection-&gt;Font-&gt;Name = 'Verdana';
	$word-&gt;Selection-&gt;Font-&gt;Size = 8;

	//Write some text
	$word-&gt;Selection-&gt;TypeText("This is a test document");
        //Insert an image
        $word-&gt;Selection-&gt;InlineShapes-&gt;addPicture("C:\\temp\\test.png");

	//Save the document as DOC file
	$word-&gt;Documents[1]-&gt;SaveAs("c:\\docs\\test1.doc");

	//quit and release COM resources
	$word-&gt;quit();
	$word-&gt;Release();
	$word = null;
}</pre>
<p>Excel:</p>
<pre style="height: 200px">
function write_excel() {
	$excel = new COM("excel.application");
	$excel-&gt;Visible = 0;

	//Create a new workbook
	$wkb = $excel-&gt;Workbooks-&gt;Add();
	$sheet = $wkb-&gt;Worksheets(1);

	//This code adds the text 'myvalue' on row 2, column 4
	$sheet-&gt;activate;
	$cell = $sheet-&gt;Cells(2, 4);
	$cell-&gt;Activate;
	$cell-&gt;value = 'myvalue';

	$wkb-&gt;SaveAs("C:\docs\test.xls");

	//close and free resources
	$wkb&gt;Close(false);
	$excel-&gt;Workbooks-&gt;Close();
	$excel-&gt;Quit();
}</pre>
<p>PowerPoint:</p>
<pre style="height: 200px">
function write_ppt() {

	$powerpnt = new COM("powerpoint.application");

	//Creating a new presentation
	$pres = $powerpnt-&gt;Presentations-&gt;Add();

	//Adds the first slide. "12" means blank slide
	$pres-&gt;Slides-&gt;Add(1, 12);

	//Adds another slide. "10" means a slide with a clipart and text
	$pres-&gt;Slides-&gt;Add(2, 10);

	//Adds a textbox
	$pres-&gt;Slides[1]-&gt;Shapes-&gt;AddTextbox(1, 20, 50, 300, 40);

	//Save the document as PPT file
	$powerpnt-&gt;Presentations[1]-&gt;SaveAs("C:\Docs\test1.ppt");

	//free resources and quit powerpoint
	$powerpnt-&gt;quit();
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.scottpreston.com/articles/615.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

