Here's another approach:
~~~~~~~~~~~~~~~~~~~~~~~~~
RTF into a Word DOC
Thank you!
I see the trick is to save the text contect back into the database first and then retrieve it again and savedocument. I will do that if I have to. Right now I am talking with the users about doing all edits in the rich text first and then save it as PDF.
Ben
--------------------------------
yes, all inputfield data are there, for .doc or .rtf document.
from window
// Copy the entire contents of the RTE control to the order_document field.
ls_text = rte_order.CopyRTF(FALSE, Detail!)
inv_tm_order.EVENT doj_SetRecordItem('order_document', ls_text) --- ls_text will be saved in the database as long raw field
ls_text then pass to a function ue_pastetext in rte object which inherited from u_rte
// Write the text to a file for inserting in the RTE control.
li_ret = inv_filesrv.of_FileWrite(is_PathName + 'template.rtf', as_text, FALSE)
// i tried with .doc as well here
// li_ret = inv_filesrv.of_FileWrite(is_PathName + 'jd.doc', as_text,
FALSE) and check the .doc file all inputfield data are there. but i have
to user rtf as i am using InsertDocument command
// Set insertion point at start of RTE control
THIS.SelectText(1,1,0,0)
// Insert template document from file.
li_ret = THIS.InsertDocument(is_PathName + 'jd.doc', TRUE, FileTypeRichText!)
IF li_ret = -1 THEN error.of_abort('InsertDocument', ls_loc, 'template.rtf')
Jenny Diep
CourtView Technical Operations , Courts Technology Group
------------------------------
we have rtf control on window, the rtf document is stored in as long raw
field in oracle data base, so when user enter inputfields, the template
can be saved and retrieve for updating, the whole document only convert to
pdf when user indicates the document is completed and save as blob in
oracle database
Jenny Diep
CourtView Technical Operations , Courts Technology Group
---------------------------
Thanks Jenny. Yes, saving the rich text as PDF works OK for me, but I'd
like to save it as Word doc so users can edit it if necessary. Right now
when I save it as a Word doc (FileTypeDoc!), it only saves the original
text from the template itself and none of the input fields data populated
at runtime are not saved. The PDF saves all of those. I may just have to
tell the users to edit all they need in the rich text control. They are
going to replace these PB apps in two or three years anyway. But I think
SAP should improve this area - make PB more word-processing friendly. I
think most apps need that. Just some basic word-processing features and do
not have to be MS Word like. And speaking of that, I have to write some
database functions and triggers to format lots of "comments, notes,
descriptions" fields, because PB does not have word wrap with the regular
edit style on a text. When users forget to press the enter key, the text
becomes a long line, and
without reformatting, they will be cut off when printing on 8.5 x 11.
Ben
----------------------
Hi, Dazhi, in our application, we have 3 rtf templates, 1 for header, 1
for text and 1 for footer. at run time user will enter details in text
template with many inputifields, when it is complete, system will merge
header, text and footer as one document and convert it into pdf and in
database as blob field. some of the steps for merging 3 templates
together are
// Copy the entire contents of the RTE control to the order_document
field.
ls_text = rte_order.CopyRTF(FALSE, Detail!)
inv_tm_order.EVENT doj_SetRecordItem('order_document', ls_text)
// Write the text to a file for inserting in the RTE control.
li_ret = inv_filesrv.of_FileWrite(is_PathName + 'template.rtf',
as_text, FALSE)
// Insert template document from file.
li_ret = THIS.InsertDocument(is_PathName + 'template.rtf', TRUE,
FileTypeRichText!)
hope it helps
Jenny
----------------------------------
This is what I have done: I use a separate rich text edit control to create some templates (with those input fields I mentioned), save them into a database table (CLOB and insert into clob_table (id, clob) values (123, empty_clob()) - this is for Oracle; not sure how SQL Server/Sybase/others handle it - UpdateBlob ). On another rich text edit, I use SelectBlob to get the saved template and then pastRTF() to fill the edit control text (could also save the clob text into a file and then insert document). It has been working since 2008 and did not have to "save" the content until now. We just needed to print the text (form letters). Now they want to save the context into a file, edit it if needed, and then attach the file into a case's document repository.
Thanks.
Ben
________________________________
On the Breck Carter's page there's one thing that makes me be in doubt (between ""):
Unlike the DataWindow painter, PowerBuilder offers no way to paint the contents of a RichTextEdit control "in the development environment. You must actually write and run a program", or use some other RTF-capable product.
Does he mean it doesn't work from interpreted PB execution and does work having created an executable and running it ????
I don't think so ... but I'll try to find out.
good night!
Miguell
---
>
> Tomorrow, if I'll have some time I'll try to do this myself, but I think the fields should be also saved.
>
> Are you sure your file extension is ".rtF" (not .rtE, though as dumb as I might sound?)
>
> check out this page (oldie) from Breck Carter, maybe it might help:
>
> http://www.bcarter.com/tip036.htm
>
> regards,
> Miguell
>
> ---
> >
> > Hi Ben,
> >
> > Very funny, doesn't make sense!
> >
> > But ...
> > 1) Maybe you could use "CopyRTF()" instead:
> > That command, is supposed to copy everything selected, including fields(). (No clipboard involved!)
> > So the "selected" contents, you could copyRFF() and then paste into a document that you previously opened using OLE ????
> >
> > 2) Maybe, depending on what version of PDF programme you are using, you could use the SaveDocument() as PDF and then (through OLE command) do some kind of a "SaveAs()" from the PDF to other fileformat????
> >
> > Hope it helps.
> >
> > Miguell
> >
> > ---
> > >
> > > Hi all,
> > > I need to save the text in a RichTextEdit control's formated text into a .doc or .rtf file, using the SaveDocument (filename, FileTypeDoc!/FileTypeRichText!). But it only saves the original text on the template. I have many input "Fields" created using the InputFieldInsert method and they are populated at runtime. None of the input fields' data can be saved in the .doc or .rtf file. However, FileTypePDF! works OK and it saves everything from the input fields. Of course the problem with the PDF is that the users cannot edit anything. Does anyone have any idea why saving the content as a .doc/.rtf file is not saving the inout fields data? I am using PB 12.1 classic.
> > >
> > > Thank you.
> > >
> > > Ben
> > >
Thanks, I have read that there are problems with rich text on pb2017 r2, what are they ?
The great news is that Appeon has now given PB developers *both* the TE and TX Control included for free in the PB2017R3 MR01 release (build 1880). So now if your mail merge DWO does not behave the exact way you need it. You can switch back & forth between the 3rd party RTE mechanisms with one change of the Application Object's RTE property.
So the big thing that you might want to think about is whether to move to the latest build of PB2017R3 before trying the RTE DW (to give you more flexibility to design and/or tweak with) RichText wise.
Food for thought. ;-)