Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: parsing a table

by hdb (Monsignor)
on Apr 15, 2013 at 12:38 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 21:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found