Hi,

I have the following problem at hand. I need to fill out a word document with values from a web form. It seems to me that the most natural way to automatically modify a word document is to use Win32::OLE module. However, I do not know how to be able to control this process from a web based interface. I wrote a CGI script that attempts to create a COM object that represents a Microsoft Word application. When I run the script it never finishes. Using the trial and error method I determined that the execution stops when I try to open a word document after the COM object has been created. Below is the sample of the code I use. The web server is IIS5 on Windows 2000. I use Perl version 5.8

# initialize Word object my $Word = Win32::OLE->GetActiveObject("Word.Application", \&QuitApp); if( !$Word ) { $Word = Win32::OLE->new("Word.Application", \&QuitApp) or die "coul +dn't create an OLE object"; } $Word->Documents()->Open("c:\\Projects\\wtemplates\\TEMPLATE.DOC"); ...

Does anyone have any experience working with Win32::OLE? What is it that is going wrong with my script? Also, maybe I am not approaching the problem the right way. Is what I'm trying to do feasible? Are there any other ways of doing this? Like, maybe, creating a Windows service to process word documents that runs continuously and communicates with my script via a named pipe?

I would appreciate any thoughts on this.


In reply to OLE from CGI - Is it possible? by relax99

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.