Windows 7, Delphi 2010, RichView 13.8
Please don't beat me, but I can't get it run:
In a form there is a TDBRichViewEdit and a TRVRuler. Everything works fine. When the user moves the ruler, left and/or right margin is set and the text in the TDBRichViewEdit formatted accordingly.
In the RVFOptions the rvoSaveLayout and rvoLoadLayout properties are checked to True.
After the record is saved to the database and loaded again the left and right margins are lost.
I searched this forum and found several things like
RVRuler1.UpdateRulerMargins in the RVAControlPanel1MarginsChanged(...) event - but this event is never fired
or
TDBRichViewEdit1.Format
Nothing of these helps.
What has to be done to save and load the formerly set ruler margins?
---
Another thing regarding the ruler:
Say, for getting a real imagination on how a later print output would look like, the right margin is set at 18 cm. Now, when sizing the window horizontally the right margin of the ruler also moves, and also the text. How can the margin be fixed to the desired position, independantly of widening the window size?
Best regards
Joe
Save and restore left/right margin?
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
1) In my test, the ruler works without any additional code.
Can you send me a simple project reproducing this problem?
2) Exclude rvoClientTextWidth from DBRichViewEdit.Options.
Assign DBRichViewEdit.MinTextWidth and MaxTextWidth.
For example, for 18 cm:
Note 1: if rvoSaveLayout and rvoLoadLayout in RVFOptions, MinTextWidth and MaxTextWidth are saved with the document, like margins.
Note 2: To assign default values (of MinTextWidth, MaxTextWidth, margins, others) use OnNewDocument event.
Can you send me a simple project reproducing this problem?
2) Exclude rvoClientTextWidth from DBRichViewEdit.Options.
Assign DBRichViewEdit.MinTextWidth and MaxTextWidth.
For example, for 18 cm:
Code: Select all
DBRichViewEdit1.MinTextWidth := Round(18 * Screen.PixelsPerInch / 2.54)-DBRichViewEdit1.LeftMargin-DBRichViewEdit1.RightMargin;
DBRichViewEdit1.MaxTextWidth := DBRichViewEdit1.MinTextWidth;
Note 2: To assign default values (of MinTextWidth, MaxTextWidth, margins, others) use OnNewDocument event.
God bless Sergey!
Due to his explanations it came out that the database field type must (and can) contain only Unicode, which makes it impossible to store an odd number of bytes. This caused the problem.
Who ever runs into a similar problem:
In a MS Access database: don't use field type "Memo"
In a MS SQL Server database: don't use field type "NText" -> use Varbinary(max) instead.
Thank you, Sergey!
Due to his explanations it came out that the database field type must (and can) contain only Unicode, which makes it impossible to store an odd number of bytes. This caused the problem.
Who ever runs into a similar problem:
In a MS Access database: don't use field type "Memo"
In a MS SQL Server database: don't use field type "NText" -> use Varbinary(max) instead.
Thank you, Sergey!
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
When you used "Unicode memo" field type, data were saved as RTF, not RVF.
In RTF, TRichView cannot save margins (RichView.LeftMargin, TopMargin, etc.)
(if you need to store page margins, you can use DocParameters property; but these are different margins: page margins are usually much larger than margins on the screen).
In RTF, TRichView cannot save margins (RichView.LeftMargin, TopMargin, etc.)
(if you need to store page margins, you can use DocParameters property; but these are different margins: page margins are usually much larger than margins on the screen).