in reply to Word tables, OLE, perl, and me.

Heh, no I'm not sure. Unfortunately, shaking my fist at it doesn't seem to fix it.

So, I am now able to move the cursor to the position I want with this:
my $word = CreateObject Win32::OLE 'Word.Application' or die $!; $word->{Visible} = 1; my $document = $word->Documents->Open('C:/temp/doctest.doc'); my $table = $word->ActiveDocument->Tables(2); $table->Range->Copy; my $selection = $table->Select; $word->Selection->MoveUp(wdLine,1);
That gets the cursor to the start of the line I want! Now I just am not sure how to pull out the full line so I can to a regular expression on it.

Replies are listed 'Best First'.
Re^2: Word tables, OLE, perl, and me.
by binf-jw (Monk) on Feb 03, 2009 at 10:08 UTC
    Just a guess as I don't have time to test this yet.. But you should probably be using 'wdParagraph' to move up.. A think a 'line' is not what you think it is, A paragraph will be terminated by the new line where as the line is just terminated by a 'wrap'.
    For example in a multiline title: Table 1: blah blah blah blah blah blah b lah blah blah. <br>
    Moving up 1 line would only get to "lah blah blah." where as up 1 paragraph would be "Table 1: blah blah blah blah blah blah blah blah blah." You could then surely just select it as follows:
    my $text = $selection->{Range}{Paragraph}{Text};
    - John