DefaultTabWidth

General TRichView support forum. Please post your questions here
Post Reply
mphilbrick
Posts: 27
Joined: Mon Aug 29, 2005 7:08 pm

DefaultTabWidth

Post by mphilbrick »

Greetings,

Is there any way to set the "DefaultTabWidth" in a TRichView or TppRichView component without using TRuler?

I am loading RTF text into a TppRichView component. If there are tab characters in the document I want it to honor whatever the current default tab setting is in the RTF text (which I can easily obtain).

I did try TRuler with a TRichViewEdit component and set the DefaultTabWidth to 2 inches in code, called Format, and the tab stops were still about 0.5 inches.

Note that custom tab settings come across fine. It is only the default tabs that are the problem.

Michael Philbrick
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

TRVStyle.DefTabWidth
mphilbrick
Posts: 27
Joined: Mon Aug 29, 2005 7:08 pm

Post by mphilbrick »

Sergey,

Problem partially solved. When I load the RTF into TRichView and set the Style.DefTabWidth the tabs are correct.

However, I then transfer the data from the TRichView component to the TppRichView component and I lose the new default tab settings when the report prints:

procedure TdlgPrintPreview.CopyCustomRVFText(src, dst: TCustomRichView);
var
Stream: TMemoryStream;
begin
Stream := TMemoryStream.Create;
src.SaveRVFToStream(Stream, False);
Stream.Position := 0;
dst.LoadRVFFromStream(Stream);
Stream.Free;
end;

I attached the same style to the TppRichView instance, attached a new style to the TppRichView instance and set (and verified) the DefTabWidth setting, called TppRichView.Format and nothing seems to help.

What is the solution?
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

ppRichView uses its own TRVStyle, accessible as ppRichView.RichView.Style.
DefTabWidth is not stored in RVF. So the only option is reassigning ppRichView.RichView.Style.DefTabWidth. Unfortunately, this value will not be stored with ppRichView (you can store it yourself, using ppRichView.RichView.DocProperties)
Post Reply