Andy,Thanks for ReplyHow should i fetch value from DCR to display data in Word document using RTF::Writer.Any suggestions..?Ace
Hi Andy,Below is what you suggested me to do to write a perl based tpl as attached. I am unable to fit RTF::Writer module to extract the value in Doc file. Could you please tell me as how to implement RTF::Writer and where to use it to get the data displayed?Thanks in Advance...Ace
<?xml version="1.0" encoding="ISO-8859-1"?><iw_pt/><iw_perl> ...</iw_perl> All cats: current cat:
open STAT_REPO, ""; my $stat_repo = TeamSite:CRparser->new()->parse(join('',(<STAT_REPO>))); close STAT_REPO;
if (open(STAT_REPO, "<:utf8", [color=purple]$filename)){ my $xml = do {local $/; <STAT_REPO>}; close(STAT_REPO);[/color] my $stat_repo = TeamSite:CRparser->new()->parse($xml); ... } ...
First, I recommend getting rid of the iw_pt tag or at least making it an empty tag (as shown below) to avoid needing all that CDATA stuff:<?xml version="1.0" encoding="ISO-8859-1"?><iw_pt/><iw_perl> ...</iw_perl> All cats: current cat: Second, you're opening a non-named-file for reading (huh?) and not verifying that you actually succeeded in opening it before you try to parse the contents (somewhat inefficiently) open STAT_REPO, ""; my $stat_repo = TeamSite:CRparser->new()->parse(join('',(<STAT_REPO>))); close STAT_REPO;I'd suggest something like: if (open(STAT_REPO, "<:utf8", [color=purple]$filename)){ my $xml = do {local $/; <STAT_REPO>}; close(STAT_REPO);[/color] my $stat_repo = TeamSite:CRparser->new()->parse($xml); ... } ...Once you've got that cleared up - then I think you need to spend some time along with some trial-and-error command line scripts, reading the perldoc for RTF::Writer so that you can understand how to use it - it doesn't magically translate XML (the DCR) into RTF - you need to do some work to tell it how to format things (in RTF instead of HTML) and use either iwpt_dcr_value('dcr....') [within iw_perl] or <iw_value name="..."/> [outside of iw_perl] to plug in the data from the DCR.