Jump to content

Recommended Posts

Hello,

 

I am using the COM function to export data from PHP to Word.

 

It works perfectly but the problem i have is that when the files are hosted on a local web server the file opens on the local web server rather than the client machine. Does anyone know how to do this on the client machine?

 

Thanks, here is the code

 

$word = new COM("word.application") or die("Unable to instantiate Word");
$template_file = "C:/letter.doc";
$word->Documents->Open($template_file);
$current_date = date("d/m/Y");
$bookmarkname = "TODAYDATE";
$objBookmark = $word->ActiveDocument->Bookmarks($bookmarkname);
$range1 = $objBookmark->Range;
$range1->Text = $current_date;
$word->visible = 1;

Link to comment
https://forums.phpfreaks.com/topic/50910-com-to-word-problem/
Share on other sites

You'd probably have to use some ActiveX script, but that would only work in IE. The PHP code gets executed on the server, therefore the data handling happens on the server.

 

You could also let the user upload the file, then convert it, then let them download it again.

Link to comment
https://forums.phpfreaks.com/topic/50910-com-to-word-problem/#findComment-250470
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.