Salut,
Comment puis-je créer un document MS Word en php chez OVH ?
Merci.
Modérateur: david96





Yatooweb a écrit:Salut,
en fait cela dépend de ce que tu souhaites inclure dans ton fichier. Est-ce du texte uniquement ou bien des documents plus complet avec des images etc... ?

<?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;
?>

Yatooweb a écrit:Tu peux essayer avec l'objet word.application
- Code: Tout sélectionner
<?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;
?>

Retourner vers Langage (standard, programmation)
Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 0 invités