web 2.0

How to use PHP & Word (Word.Application) - Create Word Document

How to use PHP & Word (Word.Application) - Create Word Document The Learn / Lutorial / Sctipts php programming how to using  PHP Create word document (.doc)

ShotDev Focus:
- PHP  & Create word document (.doc)

Example

php_create_word.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$Wrd = new COM("Word.Application");
$Wrd->Application->Visible = False;
$Wrd->Documents->Add();
$DocName = "MyDoc/MyWord.doc";

//$strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); // C:/AppServ/www/myphp

$Wrd->Selection->TypeText("Welcome To www.ShotDev.Com");

//$Wrd->ActiveDocument->SaveAs($strPath."/".$DocName);
$Wrd->ActiveDocument->SaveAs(realpath($DocName));
$Wrd->Application->Quit;
$Wrd = null;
?>
Word Created <a href="<?=$DocName?>">Click here</a> to Download.
</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_create_word.php

Screenshot

PHP & Create Word Document
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

One Response to “How to use PHP & Word (Word.Application) - Create Word Document”

  1. 1strength…

Leave a Reply

You must be logged in to post a comment.