Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: MS-Word OLE and Joining Tables

by NetWallah (Abbot)
on Dec 30, 2012 at 18:41 UTC ( #1010952=note: print w/ replies, xml ) Need Help??


in reply to MS-Word OLE and Joining Tables

Here is my (untested) take on what the perl equivalent is:

use Win32::OLE qw(in valof with OVERLOAD); Win32::OLE->Option(_NewEnum => 1); for my $oPara (in $Word->ActiveDocument->Paragraphs) { my $oRange = $oPara->Range; next unless $oRange->Information(wdWithInTable) ; $oRange = $oRange->Next; next if $oRange->Information(wdWithInTable) ; $oRange->Delete() if $oRange->Text eq vbCr; }
Update 1: Showing the "in <object>" syntax - this is what you seem to be struggling with.

             "By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest."           -Confucius


Comment on Re: MS-Word OLE and Joining Tables
Download Code
Re^2: MS-Word OLE and Joining Tables
by BrianP6 (Initiate) on Dec 30, 2012 at 19:32 UTC

    Hi NetWallah

    Thanks for that, I pasted it into my file, ran it and got.....

    Not an ARRAY reference at the 'foreach' line

    Thanks for taking the time to help me

Re^2: MS-Word OLE and Joining Tables
by BrianP6 (Initiate) on Dec 31, 2012 at 16:55 UTC

    Hi NetWallah,

    Fantastic, that does the job!! Now I'm about to start googling the use of 'in' that you've used here to find out how it works.

    One thing that I really didn't expect, is just how much it has slowed my script down. I did think it would to some extent, but it's actually gone from a total run time of 8 minutes to 36 minutes (yes I've got quite a few tables being joined). No, my PC is a fully up to date desktop running a quad core i5 - I only built it earlier this year, so it is the OLE that is slow. By comparison, the old script took 1 hour to run on my little netbook, I guess I wont be using it on this new script!

    I will be investigating better ways to issue some of the reports - maybe write them to excel and then output as PDF instead of word tables, that will improve things dramatically. But my renewal letters need to stay in Word and use this new script.

    Many thanks again oh wise one!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (15)
As of 2014-07-31 16:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (249 votes), past polls