Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: parsing a table

by hdb (Prior)
on Apr 15, 2013 at 12:38 UTC ( #1028731=note: print w/replies, xml ) Need Help??

in reply to parsing a table

Looking at an .rtf file and the spec and the available modules, the situation seems difficult. RTF::tokenizer seems helpful to reduce the complexity a bit. I have created a sample rtf file using MS Word which contains one table only and the following script gets me most contents of the table (and some more). I do not dare say whether this helps in your situation.

use strict; use warnings; use RTF::Tokenizer; my $rtf = RTF::Tokenizer->new( file => "A.rtf" ); my( $t, $a, $p ); my $on = 0; while( $t ne "eof" ) { ( $t, $a, $p ) = $rtf->get_token(); print "TYPE|$t|ARGUMENT|$a|PARAMETER|$p|\n" if $on and $t eq "text"; + $on = 1 if $t eq "control" and $a eq "ltrrow"; $on = 0 if $a eq "control" and $a eq "row"; }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2016-09-28 03:50 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (518 votes). Check out past polls.