Jump to content

Getting Fatal Error


Lakshmi

Recommended Posts

HiWhen i used com objects i'm getting this type of error"Fatal error: Cannot instantiate non-existent class: variant "how can i declare empty variant ?i declare like$var= new VARIANT();when i used liked i'm getting fatal error.Please help anyone..Regards

Link to comment
Share on other sites

Have you declared the class/structure "VARIANT" anywhere in your code? The error seems to suggest not.

i'm running this example...<?php/*$empty = new VARIANT(null);print $empty->type // ==> 1*/?><?php// Some servers may have an auto timeout, so take as long as you want.set_time_limit(0);// Show all errors, warnings and notices whilst developing.error_reporting(E_ALL);// Used as a placeholder in certain COM functions where no parameter is required.$empty = new VARIANT();// Load the appropriate type library.com_load_typelib('word.Application');// Create an object to use.$word = new COM('word.application') or die('Unable to load Word');print "Loaded Wordpd, version {$word->Version}\n";// Open a new document with bookmarks of YourName and YourAge.$word->Documents->Open('c:/newfile1.doc);// Fill in the information from the form.$word->Selection->GoTo(wdGoToBookmark,$empty,$empty,'lakshmi'); // Note use of wdGoToBookmark, from the typelibrary and the use of $empty.$word->Selection->TypeText($_GET['YourName']);$word->Selection->GoTo(wdGoToBookmark,$empty,$empty,'23');$word->Selection->TypeText($_GET['YourAge']);// Save it, close word and finish.$word->Documents[1]->SaveAs("c://{$_GET['YourName']}.doc");$word->Quit();$word->Release();$word = null;print "Word closed.\n";?>i'm using php and linux sever.in linux server com objects are avilabule?
Link to comment
Share on other sites

Well, according to your error, it doesn't know what "VARIANT" means. This is because you either havn't:A. Created a class/structure/datatype of that nameB. Included a php library that includes this class/structure/datatypeC. Not compiled PHP with the correct options on you server to access this class/structure/datatypeI would go back and check any documentation for this function to find out what it depends on.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...