Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: WIn32::OLE debug

by chafelix (Acolyte)
on Oct 12, 2025 at 17:18 UTC ( [id://11166470]=note: print w/replies, xml ) Need Help??


in reply to Re: WIn32::OLE debug
in thread WIn32::OLE debug

Thanks, I did try your advice. The result:

Tables is <Win32::OLE=HASH(0x57d0ab0)>Tables has 70 itemsbefore table loop

table=Win32::OLE=HASH(0x57d0c60) file=C:\Users\...\mydoc.docx

numrows=23

table rows count= Win32::OLE=HASH(0x5606e48)->Rows->Count

OLE exception from "Microsoft Word":

?e? e??a? d??at? ? p??s▀as? ╡e╡???╡???? ??a╡╡?? se a?t?? t? s??????, epe?d? ? p??a?a? ??e? s?????e?╡??a ?e??? ?ata????fa.

Win32::OLE(0.1712) error 0x800a1767 in METHOD/PROPERTYGET "Item" at parserworks16.pl line 188.

The failing line is the last line shown
print "table rows count= $table->Rows->Count \n"; # this print seems t +o indicate the problem foreach my $rownum (1 .. $table->Rows->Count) { my $row = $table->Rows->Item($rownum);
So it looks like $table->Rows->Count is an object instead of a number! Why is that ?

Replies are listed 'Best First'.
Re^3: WIn32::OLE debug
by choroba (Cardinal) on Oct 12, 2025 at 17:37 UTC
    Method calls are not interpolated in double quoted strings. Therefore,
    print "table rows count= $table->Rows->Count \n";

    only interpolates $table. Instead, try

    print 'table rows count = ', $table->Rows->Count, ".\n";

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      Then
      print "table rows count=", $table->Rows->Count ,".\n"; # prints 23 foreach my $rownum (1 .. $table->Rows->Count) { print "rownum=$rownum\n"; #prints 1 my $row = $table->Rows->Item($rownum); #crashes!

      OLE exception from "Microsoft Word": ?e? e??a? d??at? ? p??s▀as? ╡e╡???╡???? ??a╡╡?? se a?t?? t? s??????, epe?d? ? p??a?a? ??e? s?????e?╡??a ?e??? ?ata????fa. Win32::OLE(0.1712) error 0x800a1767 in METHOD/PROPERTYGET "Item" at parserworks16.pl line 191.

      is there a way to look at the elements of the $table->Rows object? It would appear that this does not have an Item(1) element
        PMFJI, but shouldn't
        my $row = $table->Rows->Item($rownum); #crashes!
        be more something like
        my $row = $table->Rows($rownum)->Item; # probably also crashes, but di +fferently ;-)
        ?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11166470]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2025-12-16 09:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (95 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.