WPRichText.AsString := RTF appends many ;;;;;;; [Czech]

  • Hi,
    I put two WPRichText components on the form and one button. On click event is

    Code
    WPRichText2.AsString := WPRichText1.AsString;


    After executing the code the WPRichText2 contains at the begginning many ;;;;;;;; and then the text from WPRichText1.

    For example: WPRichText1 contains text 'hello'
    Afer button is clicked, the WPRichText2 contains text ';;;;;;;;;;;;;;;;hello'

    What I am doin'g wrong?

    Petr Slipek

  • The problems is also in version 5.20. I tried ti upgrade to WPTools 5.20.

    I tried to change the TextSaveFormat and TextLoadOptions to different formats, but there are still problem. It look like the problem is not in the save part, but in the load part.

    If both RichEditors have TextSaveFormat and TextLoadFormat set as 'WPTOOLS' the assigned text looks to be correct, but if you look at the stored text, you can see that the data is not the same - there are some lines added.

    If both RichEditors have TextSaveFormat and TextLoadFormat set as 'RTF' the assigned text is with added ;;;;;;;;; at the beginning.

    There are no changed properties at all - easy to reproduce problem.

    Here are the examples (assigning text hello):

    Code
    WPRichText1.TextLoadFormat := 'RTF';WPRichText1.TextSaveFormat := 'RTF';WPRichText2.TextLoadFormat := 'RTF';WPRichText2.TextSaveFormat := 'RTF';WPRichText2.AsString := WPRichText1.AsString;


    WPRichText1 contains:

    Code
    {\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset238 Arial;}{\f2\fnil\fcharset1 Wingdings;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl1880\margr1880\margt1440\margb1440\headery720\footery720\endnhere\sectdefaultcl{\*\generator WPTools_5.2;}{\plain\f1\fs22 hello\par}}


    WPRichText2 after AsString assignement contains:

    Code
    {\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset238 Arial;}{\f2\fnil\fcharset1 Wingdings;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl1880\margr1880\margt1440\margb1440\headery720\footery720\endnhere\sectdefaultcl{\*\generator WPTools_5.2;}{\plain\fs22 ;;;;;;;;;;;;;;;;hello\par}}

    If the assign code is:

    Code
    WPRichText1.TextLoadFormat := 'WPTOOLS';WPRichText1.TextSaveFormat := 'WPTOOLS';WPRichText2.TextLoadFormat := 'WPTOOLS';WPRichText2.TextSaveFormat := 'WPTOOLS';WPRichText2.AsString := WPRichText1.AsString;

    The WPRichText1 contains:

    Code
    <!WPTools_Format V=518/><GlobalPageFormat wpcss="landscape:0;paperw:12240;paperh:15840;margr:1880;margl:1880;margt:1440;margb:1440;marg_header:720;marg_footer:720;deftabstop:720;marginmirror:0;"/><StandardFont wpcss="CharFont:'Arial';CharFontSize:1100;"/><numberstyles><nstyle id=1 wpsty=[[NumberMode:24;NumberINDENT:360;NumberTEXTB:'l';CharFont:'Wingdings';]]/><nstyle id=2 wpsty=[[NumberMode:19;NumberINDENT:360;]]/><nstyle id=3 wpsty=[[NumberMode:1;NumberINDENT:360;NumberTEXTA:'.';]]/><nstyle id=4 wpsty=[[NumberMode:2;NumberINDENT:360;NumberTEXTA:'.';]]/><nstyle id=5 wpsty=[[NumberMode:3;NumberINDENT:360;NumberTEXTA:'.';]]/><nstyle id=6 wpsty=[[NumberMode:4;NumberINDENT:360;NumberTEXTA:')';]]/><nstyle id=7 wpsty=[[NumberMode:5;NumberINDENT:360;NumberTEXTA:')';]]/><nstyle id=8 wpsty=[[NumberMode:6;NumberINDENT:360;]]/><nstyle id=9 wpsty=[[NumberMode:7;NumberINDENT:360;]]/><nstyle id=10 wpsty=[[NumberMode:8;NumberINDENT:360;]]/><nstyle id=11 wpsty=[[NumberMode:15;NumberINDENT:360;]]/><nstyle id=12 wpsty=[[NumberMode:16;NumberINDENT:360;]]/><nstyle id=13 wpsty=[[NumberMode:23;NumberINDENT:360;]]/><nstyle id=114 wpsty=[[NumberTEXTB:'p';CharFont:'Wingdings';NumberMode:24;NumberINDENT:360;]]/><nstyle id=115 wpsty=[[NumberTEXTB:'n';CharFont:'Wingdings';NumberMode:24;NumberINDENT:360;]]/><nstyle id=116 wpsty=[[NumberTEXTB:'v';CharFont:'Wingdings';NumberMode:24;NumberINDENT:360;]]/><nstyle id=117 group=1 level=1 wpsty=[[NumberMode:2;NumberTEXTA:'.';NumberINDENT:360;]]/><nstyle id=118 group=1 level=2 wpsty=[[NumberMode:4;NumberTEXTA:'.';NumberINDENT:360;]]/><nstyle id=119 group=1 level=3 wpsty=[[NumberMode:1;NumberTEXTA:'.';NumberINDENT:360;]]/><nstyle id=120 group=1 level=4 wpsty=[[NumberMode:5;NumberTEXTA:')';NumberINDENT:360;]]/><nstyle id=121 group=1 level=5 wpsty=[[NumberMode:3;NumberTEXTA:')';NumberTEXTB:'(';NumberINDENT:360;]]/><nstyle id=122 group=1 level=6 wpsty=[[NumberMode:5;NumberTEXTA:')';NumberTEXTB:'(';NumberINDENT:360;]]/><nstyle id=123 group=1 level=7 wpsty=[[NumberMode:1;NumberTEXTA:')';NumberTEXTB:'(';NumberINDENT:360;]]/><nstyle id=124 group=1 level=8 wpsty=[[NumberMode:1;NumberTEXTA:')';NumberTEXTB:'(';NumberINDENT:360;]]/><nstyle id=125 group=1 level=9 wpsty=[[NumberMode:1;NumberTEXTA:')';NumberTEXTB:'(';NumberINDENT:360;]]/></numberstyles><stylesheet></stylesheet><cs nr=1 wpsty=[[CharFont:'Arial';CharCharset:238;CharFontSize:1100;]]/><div cs=1><c nr=1/>hello</div>

    and WPRichText2 contains:

    Maybe this helps you to find the problem.

    Petr Slipek.

  • Hi, thanks for some tips. After disabling the $DEFINE READTAGOPT the text is correctly assigned. But after some investigation I found another big problem. The text is not assigned correctly if I use tables or images.

    If i create this easy table (1 row, 2 columns) - second column has red background:

    Code
    {\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset238 Arial;}{\f2\fnil\fcharset1 Wingdings;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl1880\margr1880\margt1440\margb1440\headery720\footery720\endnhere\sectdefaultcl{\*\generator WPTools_5.2;}{\*\userprops {\propname databases}\proptype30{\staticval DATA,LOOP10,LOOP100}}{\tblstart1{\trowd\trleft0\trftsWidth2\trwWidth5000\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clftsWidth2\clwWidth2500\clvertalt\cellx4224\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clcfpat13\clcbpat13\clftsWidth2\clwWidth2500\clvertalt\cellx8448\pard\intbl\itap1\li0\fi0\ri0\sb0\sa0\ql\plain\fs22 aaa\cell\pard\intbl\itap1\li0\fi0\ri0\sb0\sa0\ql\clcfpat13\clcbpat13\plain\fs22 aaa\cell\row}\tblend1}}

    after assigning this to second RichText I get messed table with 2 rows, 1 col and background color has dissapear.

    Code
    {\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset1 Wingdings;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl1880\margr1880\margt1440\margb1440\headery720\footery720\endnhere\sectdefaultcl{\*\generator WPTools_5.2;}{\*\userprops {\propname databases}\proptype30{\staticval DATA,LOOP10,LOOP100}
    }{\tblstart1{\trowd\trleft0\trftsWidth2\trwWidth5000\clftsWidth3\clwWidth8448\clvertalt\cellx8448\pard\intbl\itap1\li0\fi0\ri0\sb0\sa0\ql\plain\fs22 aaa\cell\row}{\trowd\trleft0\trftsWidth2\trwWidth5000\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clftsWidth2\clwWidth2500\clvertalt\cellx4224\pard\intbl\itap1\li0\fi0\ri0\sb0\sa0\ql\plain\fs22 aaa\cell\row}\tblend1\pard\plain\par
    }}

    For your information the WPTools are compiled with wPDF support. Can I made some other test to find the solution for this serious problem for us?

    Thanks Petr Slipek

  • If you need more info:
    I try to install fresh Delphi with only WPTools and bug is still there. I am using Delphi 2006 Update 1 Professional. I don't know if this bug is present in older Delphi. Now we are hanged up in the conversion progress because of this wrong WPTools behavior. We are unable to assign written text in the edit form to the database. Lost many formatting, messed tables, lost colours and Images..... there is something wrong. Please help with some other tips what to do.

    I will try to install WPTools on another clean machine and will do some other tests.

    Petr Slipek

    • Offizieller Beitrag

    Hi,

    please first try to seperate the assignment logic from the database. Othewise the problem is not tracable since it happens often enough that the database as truncated the data.

    I would recomend to save to a memofield (BlobField.SaveToStream) and load the data in the TWPRichText from this memofield (set Position to 0)
    (Internally AsString does the same, so there is no performance hit)

    So it is possible to dump the memo field before the loading to file to check out what is there.

    The TBX demo (part of Multidemo) has a debug method under Info\saveReload RTF. You can download the multidemo EXE and test if the problem happens there, too.

    I am also using Delphi 2006 here - I don't think this is a problem. I assume it is either the processor (64 bit ?) or the user locale. But I am not aware of anybody with same problems. The hashing in the RTF reader always worked before and I do not see why it should not work.

    Julian

  • Thanks for replying. All test I am doing are not using the database. We have application build with WPTools 4.25 where are many written texts. I tried to copy/paste this text from WPTools v4.25 editor to the test application into v5.20 editor. Than I execute code

    Code
    WPRichText2.AsString := WPRichText1.AsANSIString('RTF')


    If I have some tables or images in WPRichText1 then the assigned text is messed. If I use code

    Code
    WPRichText2.AsString := WPRichText1.AsANSIString('WPTOOLS')


    then the assigned text is correctly displayed, but each assignement adds some style definitions (lines with <nstyle id=3 wpsty......) at the beginning. Then the text stored size is groving with each AsString assignement.

    Dev. machine is P4 2,8GHz, 1,5 GB RAM - so nothing special. I also try your Multidemo tip. Thanks.

    Petr Slipek.[/code]

  • Hi,

    after running MultiDemo on 4 different computers - all with wrong result - including WMVare virtual PC, I can confirm that this is problem within WPTools.

    Second test: I try to change locale in WMVare virtual machine and that corrects the behavior!

    So, I can confirm that if I set Czech (čeština) as locale, the load and save part of WPTools didn't work. If I set english (angličtina) or deutch (němčina), everything is OK. Please, can you look at it? Or better what can I do to correct this?

    Petr Slipek

  • I changed the locale in Control Panel/ and (I dont know the correct english equivalent to) Místní a jazykové nastavení - maybe somethink like Locale and language settings.... In that dialog is combobox with many loacales. I select another one and closed the dialog. After application restart the MultiDemo works correctly. If I changed back to Czech, bug is there again.

    I Will try to recompile application with suggested changes. Stay tuned :-).

    Petr Slipek.

  • I recompiled WPTools and Test applications with the changes in WPIOReadRTF. But the bug is still there. Can you compile new MultiDemo to be sure, that I make all correctly? I can test it here.
    There are also other problems with WPTOOLS load save format (added styles). So this must be something deeper inside WPTools 5.20 with load, save or work with text on czech locale. If you need, I can send you our WMVare machine data, but this is cca 1,5 GB.

    Petr Slipek

  • Hi,

    main difference is that I don't change the locale on the 3rd tab in the dialog, but the combobox on the first tab. Which changes the format how the currency and dates are showed - It was my fault - I don't think correctly - or speak what locale means. I am not changing the locale settings, but the currency and date format. But this resolves the problem - if set something else then Czech or Slovak formatting. So, you can change the locale back to what you have and try to change the formattion to Czech - no OS restart needed. Sorry for this.

    Petr Slipek

    • Offizieller Beitrag

    Thank you,

    I think I have it. TStringList.Sort does not work alright with Czech (it uses ANSICompare inside) - I fixed that now by using CustomSort with a StringCompare. This problem is really hard to understand since RTF codes are ASCII only. But it seems so the 'c' character changes its charactercode depending on the context.

    The fix is in V5.20.1

    Julian

  • Hi,

    good news. The unit you send, works. Now it behaves correctly (just the first look) - will do some more tests later. The reason for wrong behavior may be, that Czech and Slovak languages has special letter 'ch' which is taken as one char - but consists of two letter. So in czech the correct order of letters is:
    a
    b
    c
    d
    e
    f
    g
    h
    ch /// this maybe problem
    i
    j
    .., but this is correct in our language.

    Wil this fix be officialy included in next release? And can you, please look that this bug is no in other places in WPTools, just to be sure :-).
    Thanks for your help and fix. Great support anyway.

    Petr Slipek.