web 2.0

How to use PHP & Word (Word.Application) - BuiltInDocumentProperties

How to use PHP & Word (Word.Application) - BuiltInDocumentProperties The Learn / Lutorial / Sctipts php programming how to using  PHP and Word BuiltInDocumentProperties.

ShotDev Focus:
- PHP  & Word BuiltInDocumentProperties.

Example

php_word_builtin.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->Font->Name = "Verdana";
$Wrd->Selection->Font->Size = "25";
$Wrd->Selection->Font->Bold = True;
$Wrd->Selection->Font->Italic = True;
$Wrd->Selection->TypeText("Welcome To www.ShotDev.Com");

$Wrd->ActiveDocument->BuiltInDocumentProperties("Title")->Value = "Doc Title";
$Wrd->ActiveDocument->BuiltInDocumentProperties("Subject")->Value = "Doc Subject";
$Wrd->ActiveDocument->BuiltInDocumentProperties("Author")->Value = "Doc Author";
$Wrd->ActiveDocument->BuiltInDocumentProperties("Manager")->Value = "Doc Manager";
$Wrd->ActiveDocument->BuiltInDocumentProperties("Company")->Value = "Doc Company";
$Wrd->ActiveDocument->BuiltInDocumentProperties("Category")->Value = "Doc Category";
$Wrd->ActiveDocument->BuiltInDocumentProperties("Application Name")->Value = "Doc Application Name";
$Wrd->ActiveDocument->BuiltInDocumentProperties("Keywords")->Value = "Doc Keywords";
$Wrd->ActiveDocument->BuiltInDocumentProperties("Comments")->Value = "Doc Comments";

//$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_word_builtin.php

Screenshot

PHP & Create Word BuiltInDocumentProperties
.
.
.

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) - BuiltInDocumentProperties”

  1. 2lexicon…

Leave a Reply

You must be logged in to post a comment.