use RTF::Document;
# Document properties
$rtf = new RTF::Document(
{
doc_page_width => '8.5in',
doc_page_height => '11in'
}
);
$rtf->add_text( $rtf->root(),
"Default text\n\n",
{ bold=>1, underline=>continuous },
"Bold/Underlined Text\n\n",
{ font_size=>'20pt', font=>$fCourier,
color_foreground=>$cRed },
"Bigger, Red and Monospaced.\n\n",
{ style_default=>paragraph },
{ style_default=>character },
"This is ",
[ { style=>$sGreen }, "green" ],
" styled.\n\n"
but, it doesn't appear to be in CPAN, so it could set your computer on fire, or sell guns to kids. If you find a pile of ashes where your computer was, or if a 5 year old shoots you, don't blame me...
Actually, it looks pretty complete. But I had to throw in the warning.
Update 28MAR2001 this module's in CPAN now. Its documentation still appears to be missing.
| [reply] [d/l] |
If you really want to write MS-Word docs rather then RTF
(see boo_radley above) then you've got two possibilities:
-
Reverse engineer the current MS-Word format and write your
own code to generate this format. Apart from the fact that
MS would be really thrilled about this, be aware that the
format changes regularly. Yeah, I think we agree that this
is a non-starter! So that leaves
-
Use OLE. What you'd need to do is to call VB functions to
write the document for you. This really isn't all that
difficult, if
-
you have all the help for MS Word VB on your system;
-
you use the object browser in the VB editor (accessed by
(Tools->Macros->Visual Basic) and then (View->Object Browser))
to find methods, attributes and constant values.
I really don't know of any other options.
Update Oh, I forgot to say that the second solution
isn't very portable ;) | [reply] |