Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Using OLE to view given Paragraph in MS Word Document

by ricDeez (Scribe)
on Nov 22, 2011 at 08:12 UTC ( #939386=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Using OLE to view given Paragraph in MS Word Document
in thread Using OLE to view given Paragraph in MS Word Document

I don't really understand what you want to do!

If you need to view the paragraphs being selected you could add the following:

for my $i ( 1 .. $paragraphs->Count()){ last if $i > $ParaNo; $paragraph = $paragraphs->Item( $i ); $paragraph->{Range}->Select(); # <<<<<Added sleep(1); # <<<<<Added my $style = $paragraph->{Style}->{NameLocal}; my $text = $paragraph->{Range}->{Text}; print "style=$style text=$text\n"; }

I have used placed the sleep in the loop so that you can see the paragraphs being selected in turn, otherwise it would just happen too quickly - especially since you are only interested in the first 10 paragraphs!


Comment on Re^3: Using OLE to view given Paragraph in MS Word Document
Download Code
Re^4: Using OLE to view given Paragraph in MS Word Document
by Ray Smith (Beadle) on Nov 22, 2011 at 15:53 UTC
    Your advice was spot on! This is what I was missing, to view the specified paragraph:
    $paragraph = $paragraphs->Item( $i ); $paragraph->{Range}->Select(); # <<<<<Added
    I appologize for not being clear. I have a simple application that uses Microsoft Word for user generated input source. My goal, which I can now approach with your help, is, when an error in this user input file is discovered, to bring up the source file with the view positioned to facilitate the user making required modifications to correct the error(s).

    Thanks again for the help.

      I am glad to be of help. I am fairly new to Perl myself but have quite a bit of experience in developing MS Office automation applications. They are just more fun doing in Perl!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2014-08-30 00:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (289 votes), past polls