Main Menu

HOME

.Net
ASP
Assembly
C
C++
Delphi
HTML
Java
JavaScript
MySQL
PC interface
Powershell
Perl
PHP
VBScript
Visual Basic
XML

Sedo - Buy and Sell Domain Names and Websites project info: programmershelp.co.uk Statistics for project programmershelp.co.uk etracker® web controlling instead of log file analysis

   Misc

   Amazon

   Links

    


create a word document

 

 
This snippet will show you how to create a word document

<?php
$word = new COM("word.application") or die ("couldnt create an instance of word");
echo "loaded , word version{$word->version}";
//bring word to the front
$word->visible = 1;
//open a word document
$word->Documents->Add();
//add some text to the document
$word->Selection->TypeText("this is some sample text in the document");
//save the document as sampleword.doc
$word->Documents[1]->SaveAs("sampleword.doc");
//close word
$word->Quit();
//free object resources
$word->Release();
$word = null;
?>

Comments

Developers coming from an ASP background may recognise some of the ideas here , for example.

$word = new COM("word.application") is the equivalent of this

Set objword = Server.CreateObject("word.application")

Another tool you can use is Visual Basic if you have this available.

In Visual Basic , you start a Standard executable then goto Project / References , from here you locate the Microsoft Word Library and add it to your project . This now means that you can use the object browser in Visual Basic to find out the properties , methods , classes etc of the object .

 

 

 

 

 




   Sponsors
 

   Software
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals

   Source Code
basic web control example(VB)
Length of a string(ASP)
This program shutdown your system(VB)
Display all available drives(ASP)
Title bar flash(VB)
Delete a file(ASP)
WeekDayName example(VB)
MP3 searcher(VBScript)

    




Copyright © 2003 by programmershelp.co.uk