Paragraph styles are not saved

  • If you type some text, press ctrl-b and continue typing, the text naturally becomes bold. Now try to save the text and open it again. The style wasn't saved.

    If you mark text and "bold" it, it is saved correctly.

    It seems that the document needs a tag finishing the bold text (actually it should continue in bold when opened)

  • Are we (the company I work for) the only one experiencing this problem? Many have read this post but none has added comments.
    This issue has reached a political state. So ever small it may seem some customers are really bugging us about it. Comments or hot-fixes are welcomed.

  • Depending on size and situation it may reside as a encrypted file or in a blob-field.

    I don't use dataset though. I do this:

    Code
    var  MemoryStream: TMemoryStream;begin  MemoryStream := TMemoryStream.Create;  try    WPRichText1.SaveToStream(MemoryStream);    MemoryStream.Seek(0,soFromBeginning);    result := aDokumentData.SaveFromStream(MemoryStream);  finally    MemoryStream.Free;  end;

    Save from stream determines where to put data

    We have discovered that the problem only occurs when creating new documents. We can make 1-n fields bold but when we save it's ignored. When editing the document, adding bold-fields, it saves correctly.

    When I tried what you suggested, I found out that I had nowhere to put that code-snippet. We use a TWPToolBar

    I'll reuse this post. Found out that my colleague added his parallel piece of code to handle those shortcuts:


    I'd better try to remove the redundancy here. Somehow call the button or find a shared TAction somewhere.

    I have added .Changing to the OnCharacterAttrChange. I'll go on testing.

  • Using the buttons the OnCharacterAttrChange is triggered, whereas the home made piece of code doesn't. The best solution will be that the buttons and shortcuts were same code. I'll go look for that now.

    When it is triggered the code is saved. The bold made by the code above wasn't saved whereas button-bold's were.

    I cannot find the code that the tool-bar uses. Is there really no way to attach a shortcut to these buttons? So I tried this, which doesn't work.

    • Offizieller Beitrag

    Hi,

    You need to call Changined and ChangedText in the KeyDwon event.

    This way it should work like the toolbutton.

  • I finally managed to do a fix that added shortcuts to the 3 styles and kept functionality in one place (in the TWPRichText.OnKeyDown).


    Thanks for the input.