Beiträge von Sleep

    Hi,

    I finally found the reason, why WPTools isn't showing correct danish characters.

    The reason is because you are using array WPToUnicodeW to convert chars 127 to 255 to other chars before drawing them. If I removed this code (just let the chars to be as entered) and then all troubles gone away. I must removed also the same code for saving char as HTML etc... The WPToUnicodeW array is used in 5 or 6 methods.

    Are there any side efects of not doing this conversion?

    Thanks for your help.

    Hi,

    I was searching for some problems with memory allocation while printing report with Report Builder and find out that there is a problem withing Report Builder wrapper for WPTools.

    The main problem is, that Report Builder wrapper is using following code in SetRichText method:

    Code
    FPaintEngine.RTFData.SetANSIString(Value);
      FixTables;
      FPaintEngine.ReformatAll(True);
      FreeAndNil(FCurrentPageImage);

    but there is a problem, that FPaintEngine.RTFData.SetAnsiString call creates all necessary TWPObject's, but doesn't Destroy already created ones. So if you use TppWPRichText component on detail band and you print rich text with many images within RTF, you end up with Out of memory exception. The wrapper creates just one instance of TppWPRichText and reloads its content for each detail band. It ends up that there can be more then 1000 TWPobject instances in memory and all these created TWPObject's descendands are destroyed after destroying FPaintEngine object. No memry leaks are detected - this is just problem with memory allocation while generating report. After destroying report all memory is freed correctly.

    I modified the source that I destroy and create FPaintEngine before calling SetAnsiString method and all memory problems are gone. Is there any other method how to destroy unecessary TWPObjects in FPaintEngine? Can you also update the source to correct this bug?

    After fixing this issue, I was able to print report with more than 1000 pages without any issue. I was able to print only about 200 pages and the app crashed before applying fix.

    Petr Slipek.

    Hi,

    thanks for the demo. In the sended demo I am able to correctly enter danish characters. So there is some difference in our Delphi setup, because if I compile the app on our system, I am unable to enter correct symbols. I redownloaded latest WP6 source and look at the differences in the *.pas files and I can see no difference in my current source and your default source. Only few differences in INC files (I am using also wPDF). Is there any option I should look for?

    Hi,

    can you send me the compiled demo from your computer and I will test it here? I tried to change Windows locale here too but it has no effect on the editor. But when I use original english version of Windows, everything works as expected. I can enter czech and danish characters in the same editor without problem.

    Send me, please, compiled exe to email slipek.at.dosli.cz. Thanks.

    Hi,

    any news about this? We have really big problems because of this WPTools behavior. Some of our customers in Czech republic (with czech windows) are creating content for their needs. But they need to create content for danish or deutsh users. Currently they cann't use our product and I have no easy way how to solve it. :-(

    PS: All other VCL controls works correctly. I don't need to change anything to be able to write correct unicode symbols in these controls. So I see it as a bug in WPTools.

    Hm, I am sorry, but it didn't work. I created clean sample application. In the application I created one WPRichText component. In OnCreate for the form I write:

    Code
    procedure TForm1.FormCreate(Sender: TObject);begin  WPRichText1.Memo._CodePage := 1250;  WPRichText1.CurrAttr.CharSet := ANSI_CHARSET;end;


    But when I paste the text, it is always wrong. I traced values in PasteFromClipboard, where I changed source as suggested.

    Code
    .....
        CodeSite.Send('CodePage', Memo._CodePage);
        load := FMemo.LoadFromStream(Stream,
          not (wpcoDoNotUseInsertMode in FClipboardOptions)
          , 'AUTO;Codepage=' + IntToStr(Memo._CodePage), false, Reader, InternBeforePasteEvent);
       ......

    I always received correct CodePage 1252, but the text is loaded and displayed with wrong symbols. :(

    Hi,

    You mean that I need to change the WPTools source? But what should I do, if I need to just enter the text with keyboard. Not just with pasting by clipboard? Is it possible to somehow use CurrAttr.CharSet value to select the right codepage when inserting or writing text?

    And how should I use InputString method to correctly insert the right symbol?

    Hi,

    I am sorry, but I have still problems on Windows 7 running at code page 1250.

    I just created complete new project. Clean application with two TWPRichText component on the form. I checked that $DEFINE UPDATECODEPAGE is ON. In one editor I set wpDisableAutoCharsetSelection to True. When I copy text directly from this forum and paste it in both editors I always get following text pasted. And I can see no way how to change this...

    Code
    Test ĆŘĹćřĺ 234564ščřžýáíí

    I am using WPTools 6.29.1.

    For testing just try to copy/paste with keyboard following UNICODE text into any of your demo apps. I never got correct result in WPTools editor.

    Zitat

    Test ÆØÅæøå 234564ščřžýáíí

    If I run for example you numberings demo and paste this text into WPTools you will see wrong text. If I enter the same text into the memo in the same app, text is inserted correctly.

    More information for the problem.

    I am using WPRichText.FontSelect method. You have a bug in this method, because you are not correctly assigning selected CharSet to CurrAttr. I updated your source and now I am able to correctly set charset in the font dialog. I then setup ANSI_CHARSET to Arial Unicode MS. But this doesn't help with my problem. I am still not able to enter danish characters also by keyboard in combination with czech windows. I have installed danish keyboard and changed locale in system options, but WPTools still uses the EASTEUROPE_CHARSET to display the characters between 127 and 255.

    It doesn't work, because this is code in WPTools, where you can see that CodePage has no meaning in InputString. And InputString directly calls InputStringW. :-(

    I am using Arial Unicode MS font. The problem is, that WPTools always uses EASTEUROPE_CHARSET for characters between 127 and 256. If I run CharMap from Windows, I can see in this font difference when selecting Unicode CodePage - which I need and Eastern Europe CodePage - this characters I got for needed chars. I need to say that in all other VCL text editting controls are these symbols correctly visible.

    Hi,

    I have really big probelm. We are using WPTools on czech Windows (it uses easteurope_charset). One of our customers need to enter danish text with special characters. But in WPTools I always see wrong characters.

    For example instead of UNICODE (UTF-8) char $00E6 (æ) I got in WPTools always char E6 from EASTERNEUROPE_CHARSET (ć). How can I force WPTools to accept the unicode symbol. I am using method WPRichText.InsertString(Chr($00E6)). What is the correct way to handle this? If I use codes bigger then 256, I got always correct UTF-8 symbols in text.

    Thanks for any help.

    PS: I am using WPTools 6 in XE2.

    Hi,

    I look in the customer area after some time and discovered, that there are no new updates to WPTools. The latest available version is 6.25 from 12 March 2012. Is this correct?

    Are you working on anything new? :-)

    Thanks for sharing any news with us.

    Hi, I have problem with wPDF export device for Report Builder. I am using the latest wPDF 3.75 with Report Builder 14.04 in Delphi XE2 Update 4.

    If I try to print report to wPDF device, I always get "Cannot start PDF document" error. You can duplicate this error easily by creating sample application with TppReport + TButton + TSaveDialog components. In the OnButtonClick event write code:

    var
    MD: TppwPDFDevice;
    begin
    if SaveDialog1.Execute then
    begin
    MD := TppwPDFDevice.Create(nil);
    try
    if MD <> Nil then
    begin
    ppReport1.AllowPrintToFile := True;
    ppReport1.BackgroundPrintSettings.Active := False;
    ppReport1.BackgroundPrintSettings.Enabled := False;
    ppReport1.ShowPrintDialog := False;
    ppReport1.InitializeParameters;
    MD.FileName := SaveDialog1.FileName;
    MD.Publisher := ppReport1.Publisher;
    ppReport1.PrintToDevices;
    end;
    finally
    MD.Free;
    end;
    end;

    If you run the app, you get the message. The empty file will be created.I used this code in the prior ReportBuilder version 12 and all works as expected.

    Petr Slípek.