RTF Code Optimization
RTF Code Optimization
Hi,
How can I optimize the RTF code as possible, I found the size of the generated code is huge.
Note :
I do not want more than
Pictures.
Text Formating 'color B,I,U Alignments Bullets FontFace FontSize indents'
undo,redo
Thanks in advance.
How can I optimize the RTF code as possible, I found the size of the generated code is huge.
Note :
I do not want more than
Pictures.
Text Formating 'color B,I,U Alignments Bullets FontFace FontSize indents'
undo,redo
Thanks in advance.
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Make sure that the following options are excluded from RTFOptions property: [rvrtfSaveStyleSheet, rvrtfDuplicateUnicode], and the following option is included: [rvrtfSaveJpegAsJpeg].
Two possible reasons for huge RTF files:
1) Pictures, especially bitmaps. Pictures in RTF have double size (comparing with saving them in files). Bitmaps may be huge.
To solve this problem, convert all images to PNG and call RV_RegisterPngGraphic (see http://www.trichview.com/forums/viewtopic.php?t=89)
2) Large number of unnecessary styles. Make sure that you call DeleteUnusedStyles.
As for exe file size, see comments in RV_Defs.inc
Two possible reasons for huge RTF files:
1) Pictures, especially bitmaps. Pictures in RTF have double size (comparing with saving them in files). Bitmaps may be huge.
To solve this problem, convert all images to PNG and call RV_RegisterPngGraphic (see http://www.trichview.com/forums/viewtopic.php?t=89)
2) Large number of unnecessary styles. Make sure that you call DeleteUnusedStyles.
As for exe file size, see comments in RV_Defs.inc
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Probably you call it in improper place. May be you have mismatched calls of SetUndoGroupMode.
The best way to call DeleteUnusedStyles is just before loading, or when creating a new document (in both cases - just after calling Clear).
You can also call it before saving, but it clears all undo and redo history.
The best way to call DeleteUnusedStyles is just before loading, or when creating a new document (in both cases - just after calling Clear).
You can also call it before saving, but it clears all undo and redo history.
When I used this method it minimized the code,but it is not the optimal.
Check this please:
if I wrote:
• try this one.
• Aida.
then the code generated through richviewedit is:
{\rtf1\ansi\ansicpg0\uc1\deff0\deflang0\deflangfe0{\fonttbl{\f0\fnil\fcharset1 Arial Narrow;}{\f1\fnil\fcharset1 Arial;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\*\listtable{\list\listtemplateid1849087502\listsimple1
{\listlevel\levelnfc23\leveljc1\li0\fi0\jclisttab\tx150{\leveltext\'01\'b7;}{\levelnumbers;}\f1\fs16}
\listid435039309}
{\list\listtemplateid586093958\listsimple1
{\listlevel\levelnfc0\leveljc0\li300\fi0\jclisttab\tx600\levelstartat1{\leveltext\'04\'00. ;}{\levelnumbers\'01;}\f1\fs24}
\listid1442366880}
}
{\*\listoverridetable
{\listoverride\listid435039309\listoverridecount0\ls1}
{\listoverride\listid1442366880\listoverridecount0\ls2}
}
\uc0
\pard\li300\fi0\jclisttab\tx600\qc\ri0\sb0\sa0\itap0 {\listtext\pard\plain\f1\fs24 1. \tab}\ls2\ilvl0 \plain \f0\b\fs44\cf2 Test This}
Another important problem :
there is a missed \par at the end of the code, are there any property can put it, I mean when using any other rtf editor I find it, while when using RichViewEdit I do not '.
Check this please:
if I wrote:
• try this one.
• Aida.
then the code generated through richviewedit is:
{\rtf1\ansi\ansicpg0\uc1\deff0\deflang0\deflangfe0{\fonttbl{\f0\fnil\fcharset1 Arial Narrow;}{\f1\fnil\fcharset1 Arial;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\*\listtable{\list\listtemplateid1849087502\listsimple1
{\listlevel\levelnfc23\leveljc1\li0\fi0\jclisttab\tx150{\leveltext\'01\'b7;}{\levelnumbers;}\f1\fs16}
\listid435039309}
{\list\listtemplateid586093958\listsimple1
{\listlevel\levelnfc0\leveljc0\li300\fi0\jclisttab\tx600\levelstartat1{\leveltext\'04\'00. ;}{\levelnumbers\'01;}\f1\fs24}
\listid1442366880}
}
{\*\listoverridetable
{\listoverride\listid435039309\listoverridecount0\ls1}
{\listoverride\listid1442366880\listoverridecount0\ls2}
}
\uc0
\pard\li300\fi0\jclisttab\tx600\qc\ri0\sb0\sa0\itap0 {\listtext\pard\plain\f1\fs24 1. \tab}\ls2\ilvl0 \plain \f0\b\fs44\cf2 Test This}
Another important problem :
there is a missed \par at the end of the code, are there any property can put it, I mean when using any other rtf editor I find it, while when using RichViewEdit I do not '.
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
The only thing that can be optimized in this code is reducing color table ({\colortbl ... }) Like MS Word, TRichView always adds standard VGA colors to the beginning of this table.
I do not plan to change it. If you want you can change CRVData.pas, from
to
Lists (bullets&numbering) cannot be optimized. Standard RichEdit saves simplified version of lists, but it is obsolete.
As for \par, it will be fixed.
I do not plan to change it. If you want you can change CRVData.pas, from
Code: Select all
const ArrDefColorTable: array [0..16] of TColor =
(
clWindowText, clBlack, clBlue, clAqua,
clLime, clFuchsia, clRed, clYellow,
clWhite, clNavy, clTeal, clGreen,
clPurple, clMaroon, clOlive,
clGray, clSilver
);
Code: Select all
const ArrDefColorTable: array [0..0] of TColor =
(
clWindowText
);
As for \par, it will be fixed.
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
1. Not tested, but I think there must be no bad effects, because after adding default colors, TRichView adds colors that are necessary for the given document (if they are not included in previously added colors).
The main reason why default color table is added - some editors use the first colors of this table for text highlighting.
2. The ending \par problem is not fixed yet. I'll provide fix later this week.
The main reason why default color table is added - some editors use the first colors of this table for text highlighting.
2. The ending \par problem is not fixed yet. I'll provide fix later this week.
hi
I want to know if my problem is solved in v1.9.24(missing \par from the end of the RTF Code)....
if yes, I tested this package;
'compiled an old project which used old RichViewEdit after installing the new pachage but the problem appered again it is not solved'..
Would you please solve it for me as soon as you can or tell me what I have to do to solve it now.
What is the best version I can use which does not have this problem...
I want to know if my problem is solved in v1.9.24(missing \par from the end of the RTF Code)....
if yes, I tested this package;
'compiled an old project which used old RichViewEdit after installing the new pachage but the problem appered again it is not solved'..
Would you please solve it for me as soon as you can or tell me what I have to do to solve it now.
What is the best version I can use which does not have this problem...
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: