Title: RE: Script for get BuiltinDocumentProperties from Office doc.

There are problems with relative paths in the CGI usually.
We "ASPers" use $Server->mapPath(). Try to use this example for CGI, HTH.
(It is for IIS and it assumes you have ADSI avail.)
JB

use Win32::AbsPath qw(FixPath);
use Win32::OLE;
print "Content-type: text/html\n\n";
print "<html><head></head><body>";
print mapPath("../bin/text.txt"),"<br>";
print mapPath("/bin/text.txt"),"<br>";
print "</body></html>";


# This function returns fullpath relative to the script itself if given
path starts with '..'  and to the WWW server root otherwise
sub mapPath {
        my $given = shift;
        my $ScriptPath = $ENV{PATH_TRANSLATED};
        my $AdsPath = sprintf "IIS://%s/W3SVC/%d/Root",@ENV{SERVER_NAME,INSTANCE_ID};
        my $IISroot = Win32::OLE->GetObject($AdsPath)->{path};
        my $result = $given =~ /^\.{2}/ ? "$ScriptPath/$given" : "$IISroot/$given" ;
        $given =~ s#//#/#;
        return FixPath $result;
}


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 29, 2001 1:43 PM
To: [EMAIL PROTECTED]
Subject: Script for get BuiltinDocumentProperties from Office doc.



Hello all,

I try to get some properties from an Excel or Word document with this
script. It works fine on DOS windows but not in Internet Explorer. I am
using IIS 4.0 and Office 98.

#Example to get document title

     use Win32::OLE;

     print "Content-type: text/html\n\n";

     print "<html><head></head><body>";

     print "Example to get document title<br>\n";

     $xl = Win32::OLE->GetObject("/Intranet/test.doc");
     $title = $xl->BuiltinDocumentProperties(1)->{Value};
     print "Title: $title<br>\n";

     $xl -> close(0);

     print "</body></html>";

Thanks,

Ignacio Lacosta,
Spain.



_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to