hi all,

I have a perl script that exports an excel chart to a png file. This works fine when I run it through prompt. but it doesn't work If I call it from asp. perl script is
use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); use Win32::OLE; use Win32::OLE::Const; $Win32::OLE::Warn = 3; # die on errors... my $filter = 'PNG'; # can be GIF, JPG, JPEG or PNG $filename = "C:\\graph1.xls"; my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); # use the Exc +el application if it's open, otherwise open new my $Book = $Excel->Workbooks->Open( $filename ); # open the fi +le foreach my $Sheet (in $Book->Sheets) { # loop through all shee +ts foreach my $ChartObj (in $Sheet->ChartObjects) { # loop throug +h all chartobjects in the sheet #$pngsave = join("",split(/\s+/,$graphtitle)); $dirpath = "c:\\Tt"; mkdir ("$dirpath", 0777); my $savename = "$dirpath\\test" . ".$filter"; #check out the +variable name # Write image to PNG file $ChartObj->Chart->Export({ FileName => $savename, #check out t +he variable name FilterName => $filter, Interactive => 0}); } }
ASP code is
<html> <body> <form action = "disp.asp" method = post> Enter a Value <input type = "text" name = "fname" size = 20> <input type = "submit" value = "click"> </from> <% dim nm nm = request.form("fname") if nm <> "" then response.write("<center> <br> hi "& nm &"</center>" ) response.write("<center> <br> have a good start </center +>") set shell = Createobject("wscript.shell") shell.run "cmd.exe /c C:\\Perl\\bin\\perl " & nm, 1, 1 set shell = nothing end if %> </body> </html>
This works in some systems & doesn't in some. Its not giving any error.

Do I need to register any activex dll for this? If so what all dll's I need to register?

Thanks in advance

Considered by jdporter - Retitle: "ASP -> Shell -> Perl -> Excel doesn't seem to work"
Unconsidered by castaway - Keep/Edit/Delete: 9/16/0 - Looks fine to me


In reply to Perl, Win32::OLE, ASP by Nalina

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.