tags:

views:

285

answers:

2

If any formatting is done in runtime in richtext how to save it to the database in PowerBuilder.Pls provide with me an example ASAP.Let me know whether is it possible to do it?

Very Urgent.. Pls somebody help??

+3  A: 

With PB11.5, you can create a DataWindow column of edit type richtext, and do this as you would any other data in a DataWindow.

Prior to 11.5, you should save the document out to a temporary directory, read the file into a blob, UPDATEBLOB, then delete the file. I don't have working code, and I don't want to throw something up here off the top of my head and suggest that it will work, so here's some bits and pieces that will help you put your own together:

Temporary Dir/File External Function Prototypes (I supplied Unicode versions, but you didn't mention what version you're on)

Function ulong GetTempPath (ulong nBufferLength, ref string lpBuffer) library "KERNEL32.DLL" Alias for "GetTempPathW"

Function uint GetTempFileName (ref string lpPathName, ref string lpPrefixString, uint uUnique, ref string lpTempFileName) Library "KERNEL32.DLL"  Alias for "GetTempFileNameW"

rte.SaveDocument ( filename {, filetype {, encoding }} )

FileOpen()

FileReadEx()

FileClose()

UPDATEBLOB

FileDelete()

Good luck,

Terry

Terry
A: 

You can use the CopyRTF function to get the source of the RTF text currently selected, including all the RTF formatting. Then, you can save the raw RTF source as a string in your DB. Similarly, you can use PasteRTF to transfer raw RTF source to the RTF edit control.

eran