Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 10-24-2017, 07:15 PM
esam2002 esam2002 is offline
Junior Member
 
Join Date: Oct 2017
Posts: 3
Default i have problen in richedit

i try to change the font in richedit and i want to save the font after change in access
but this is not worked can help me for do this
Attached Images
File Type: jpg 1.jpg (13.8 KB, 9 views)
Reply With Quote
  #2  
Old 10-25-2017, 02:05 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,058
Default

Hi,

Are talking about run-time or design-time? Could you explain more?
__________________
Regards,
Abdulaziz Jasser
Reply With Quote
  #3  
Old 10-26-2017, 08:03 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,218
Default

Since you provide soooooo much information, a guess to your questino:

You use RichEdit.Text and it loses all formatting (rtf).
So you need to save the RTF rather then the PlainText.

Easiest is to extend it with a property (if there isn't 1 already in the later Delphi versions).
Implementation would be something like:
Code:
function TRichEdit.RtfText(): String;
var
  stream: TMemoryStream;
begin
  stream := TMemoryStream.Create;
  try
    // get the rtf in a stream
    Lines.SaveToStream(stream);
    // stream to string
    stream.Position := 0;
    SetString(Result, PChar(stream.Memory), stream.Size div SizeOf(Char));
  finally
    stream.Free();
  end;
end;
NB: Code not tested, just written here to give you the basic idea...
Reply With Quote
  #4  
Old 11-02-2017, 04:14 PM
esam2002 esam2002 is offline
Junior Member
 
Join Date: Oct 2017
Posts: 3
Default i want try change font in richedit

i want change the font in this form when i click edit and select text it was changed
but when i want save after change it not saved
Attached Images
File Type: jpg Probleme.jpg (17.1 KB, 2 views)
Attached Files
File Type: zip Font.zip (30.7 KB, 3 views)
Reply With Quote
  #5  
Old 11-02-2017, 08:03 PM
rojam rojam is offline
Senior Member
 
Join Date: Jun 2015
Posts: 173
Default

No wonder you are losing the font data. All you are doing is saving RichEdit1.Text to your database. RichEdit1.Text only contains the text contained within the RichEdit1, none of the formatting.

Delphi has a DBRichEdit, that can save it's data directly to a database. Have you tried to that component?

If you insist on using RichEdit vs. DBRichEdit, there's an example on how to save to Access DB here.
Reply With Quote
  #6  
Old 11-02-2017, 10:15 PM
esam2002 esam2002 is offline
Junior Member
 
Join Date: Oct 2017
Posts: 3
Default

I tries a lot to change it but there is no chance so if that possible can you change it in the same file which I upload it earlier

Thank you in advance
Reply With Quote
  #7  
Old 11-03-2017, 08:23 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,218
Default

Should I quote my own reply?

What have you done with what I suggested?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 10:09 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.