Why I can't set the CharWrap property at runtime. I need to set the CharWrap property at rumtime when I Show Chinese then True, Other Then False. I used RB5.56,RB6.02 with delphi 5, but not work correctly.
Thank you for your answer, I tested it, it is run once. But I need to change the CharWrap property at every record. For Example,I have 4 recordes,like as:
E, English sentence... C, Chinese sentence... E, English sentence... C, Chinese sentence...
When the record's first field is 'E',Then Set CharWrap=False Else Set CharWrap=True, I had been tried in TppDetailBand.BeforeGenerate and BeforePrint the event had been run, but the CharWrap value can't by changed.
There is an explicit check to disallow this, because it will cause problem when strethcing text breaks across pages and it will cause problems for the text engine. You will have to change your copy of the source and recompile using ..\RBuilder\Source instead of ..\RBuilder\Lib. You'll also need to remember that you need to make this source change in every subsequent version of RB that you install.
Look in ..\RBuilder\Source\ppMemo.pas for this method and comment out the first exit line.
procedure TppCustomMemo.SetCharWrap(Value: Boolean); begin
Now, I have a new problem, When I Fix the source code about CharWrap, and runtime to set it True, 1. the Chinese word may cutted by TppMemo And TppDBMemo components,I mean is that one Chinese word have 2 byte, but sometimes the Chinese word may force to next line and only the second byte show. 2. when the sentence have Chinese word and English word, the English word may cut not correctly, for example: I hope the result is : ....... Components have ....... But, it may show: ...... Compon ts have .....
The canvas is determining the text width of the text in this case. The canvas is going to be the default printer's canvas. You can test this by getting the canvas and performing the text width call in a separate test project.
Comments
the Charwrap setting while the report is generating.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
But I need to change the CharWrap property at every record.
For Example,I have 4 recordes,like as:
E, English sentence...
C, Chinese sentence...
E, English sentence...
C, Chinese sentence...
When the record's first field is 'E',Then Set CharWrap=False Else Set
CharWrap=True,
I had been tried in TppDetailBand.BeforeGenerate and BeforePrint
the event had been run, but the CharWrap value can't by changed.
when strethcing text breaks across pages and it will cause problems for the
text engine. You will have to change your copy of the source and recompile
using ..\RBuilder\Source instead of ..\RBuilder\Lib. You'll also need to
remember that you need to make this source change in every subsequent
version of RB that you install.
Look in ..\RBuilder\Source\ppMemo.pas for this method and comment out the
first exit line.
procedure TppCustomMemo.SetCharWrap(Value: Boolean);
begin
if Printing then Exit;
---
--
-
end;
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
runtime to set it True,
1. the Chinese word may cutted by TppMemo And TppDBMemo components,I mean is
that one Chinese word have 2 byte, but sometimes the Chinese word may force
to next line and only the second byte show.
2. when the sentence have Chinese word and English word, the English word
may cut
not correctly, for example:
I hope the result is :
....... Components
have .......
But, it may show:
...... Compon
ts have .....
I need your help. Cheers
canvas is going to be the default printer's canvas. You can test this by
getting the canvas and performing the text width call in a separate test
project.
lCanvas := ppReport1.Printer.Canvas;
lCanvas.TextWidth(YourText);
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com