php Writing of Word Document

main.php

$html = get_include_contents('test.php');
file_put_contents("wor33d.doc", $html);
function get_include_contents($filename) {
    if (is_file($filename)) {
        ob_start();
        include $filename;
        return ob_get_clean();
    }
    return false;
}

test .php

<?php
echo $html='<!DOCTYPE html>
<html>
<body>
<h1>My First Headidsdfsng</h1>
<p>My first paragrsdssdaph.</p>
<![if !mso]>
<table cellspacing="0" cellpadding="0" border="0" width="8.4cm">
  <tr>
    <td>OpenOffice.org Version</td>
  </tr>
</table>
<![endif]>
<!--[if mso]>
<table cellspacing="0" cellpadding="0" border="0" width="8.4cm">
  <tr>
    <td>Microsoft Word version</td>
  </tr>
</table>
<![endif]-->
</body>
</html>
';
?>

http://de.wikipedia.org/wiki/Conditional_Comments

 

 

Advertisements

About rahul23134654

Hi, I am Rahul Meha , B.E. in (I.T.)
This entry was posted in PHP, Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s