Hi Andy,

Found this link that I had a little while back - not sure if in itself it's
particularly useful but explains neatly how RTF formats images and has some
potentially useful links, particularly irfanView that allows conversion to
WMF - which seems to be the format used in RTF:

http://www-106.ibm.com/developerworks/xml/library/x-tiprtfg.html

Best of luck,

H.

-----Original Message-----
From: Andy Richards [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2003 08:46
To: Hue Holleran
Cc: 'Struts Users Mailing List'
Subject: RE: [OT] RE: microsoft .doc struts


Thanks hue,

This shall be the route we will take i think, i had a play around with
rtf, and cutting and pasting the images sections into different
documents, and eveything worked fine. As you suggest though i need some
kind of way to do this on the fly? will have to look into this one.
Regular expressions make sense thanks, would this not be asier to do
with a velocity template in java? , i have never implemented one i am
just guessing? geeting a good idea of what i am going to do
though....thanks for the help.

Regards

Andy

On Tue, 2003-02-18 at 18:36, Hue Holleran wrote:
> Hi Andy,
>
> The (MS) reference was because this was using the regular expression
syntax
> used by Microsoft's VBScript RegEx object and I'm not sure if this is the
> correct format for java regular expressions. I think jakarta-oro is a reg
ex
> library that is included with struts - but sorry I have no experience with
> this - although someone on this group almost certainly will - so might be
> worth a separate post - but the example will serve as a good start point.
It
> basically means:
>
>   \[    - string to match begins with "["
>           ("[" is escaped because it's a delimiter)
>   \S    - match any non-whitespace
>   [     - (delimiter)
>     ^\[ - stop if you encounter another "["
>           (to trap error with unclosed [] blocks)
>   ]     - (delimiter)
>   *     - match any character
>   \]    - ends with "]"
>           ("]" is escaped because it's a delimiter)
>
> Images would be a different problem - if you look at an RTF file then it
is
> quite straightforward to extract the image from the rtf - but each image
> would need to be converted in this way or find some way of doing this
> on-the-fly - but I'm not aware of any tool to do this! If you have a
limited
> number of images, e.g. logos etc. then it would be possible to insert the
> converted one of these at the appropriate point. Images begin with
something
> like:
>
>       {\*\shppict{\pict{\ ... }} with loads of hex digits in-between.
>
> If you have loads of images stored as say gifs or jpgs then you will need
to
> find some way of doing this on-the-fly to rtf format.
>
> Hope the above helps a bit more.
>
> H.
>
> -----Original Message-----
> From: Andy Richards [mailto:[EMAIL PROTECTED]]
> Sent: 18 February 2003 15:53
> To: 'Struts Users Mailing List'
> Cc: [EMAIL PROTECTED]
> Subject: Re: [OT] RE: microsoft .doc struts
>
>
> Hi hue,
>
> sounds great, i understand that you replace dynamic data into the
> template where where ever you have a [oTb*.field]. but what is (MS) reg
> ex,,,? some kind of regular expression api? if so i will have to do some
> more research as i am yet to understand regular expressions, and how to
> use them. (there is a jakarta api i think though). Also does this method
> work with images?, if so i think this is the route i will have to take.
>
> Regards
>
> Andy
>
> On Tue, 2003-02-18 at 15:36, Hue Holleran wrote:
> > Hi Andy,
> >
> > I've looked through the thread and can't see specifically what you're
> trying
> > to do but we had exactly the same problem and was solved using RTF,
thus:
> >
> > (this was for submission of documents to a UK government body that
needed
> to
> > be in MS Word .DOC format - they were able to open these documents with
no
> > problem in Word: edit, print, save etc.).
> >
> > We used RTF for the document - generated manually in MS Word and
exported
> to
> > a .RTF - and used placeholders to hold active data that was to be
inserted
> > into the template of format "[oTbl.Field]" (allowable in RTF - and
> replaced
> > these using (MS) reg ex of format "\[\S[^\[]*\]").
> >
> > This then gave us an RTF format document which was then saved with the
> > extension .DOC - which MS Word opens with no problem at all. This was in
> > fact sent to the browser by adding a header "content-disposition" of
type
> > "attachment; filename=""WORD.DOC""" and also specifying the
"ContentType"
> of
> > "application/rtf". Saving this document saves the document in "Word"
.DOC
> > although it is really an RTF.
> >
> > Not sure it's what you're after but after battling trying to open MS
Word
> on
> > the server - which needs administrator privileges for the user running
the
> > web app (scary) or using vbscript/javascript in the browser (requires
the
> > site to be added to IE "Trusted Sites") - not ideal.
> >
> > The solution outlined, using RTF is not dependent on the browser used
and
> > the above solution is being used to generate around 200-300 (probably
> more)
> > "MS Word" .DOC files a week which are emailed directly to the UK
> government
> > body.
> >
> > Let me know if this is an option for you - and if you need any more info
> but
> > BTW the above was implemented in MS ASP so I can only send you some
> > ASP/VBScript code if that will help.
> >
> > H.
> >
> > -----Original Message-----
> > From: Andy Richards [mailto:[EMAIL PROTECTED]]
> > Sent: 18 February 2003 14:12
> > To: [EMAIL PROTECTED]
> > Subject: microsoft .doc struts
> >
> >
> > Hi,
> >
> > I have read with interest from the struts archives where a user posted
> > the following question to do with producing microsoft .doc files for
> > clients. See:
> > http://www.mail-archive.com/struts-user@jakarta.apache.org/msg58536.html
> >
> > Peter S. Hamlen: posted a follow up talking about using office 2000
> > html, see:
> > http://www.mail-archive.com/struts-user@jakarta.apache.org/msg58536.html
> >
> > What i cant understand and i am hoping that someone will be able to help
> > me, is that once you have parsed the .html template ie with velocity,
> > then how do you convert the html back to a .doc file. I could provide
> > for download the html pages, but the images i want to include would be
> > seperate from the html file. I am trying to think of a tidier way?
> > looking down the thread .rtf format is not the easiest, and POI is in a
> > early release. Anyone know what i can do? or have any suggestions?
> >
> > dont worry i made my point about cross platform and proprietory .doc,
> > doc is what the client wants, and therefor .doc is what i am having to
> > try and give.
> >
> > Regards
> >
> > Andy
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to