Trouble saving/restoring RTF with graphics to DB

  • Hi + tx for any info.

    Using WP 6.25m MS SQL 2008 R2

    I have a TDBWPRichText connected to a TQuery and a Field of tye TMemoField - undrlying DB type is TEXT. I finally managed to save my RTF with graphics included to the DB setting the wobRTFnobinary.

    However, when I now try to load the saved RTF into the TDBWPRichText, I receive a "list index of ouf bounds".

    Can anybody direct me how to save/rsetore RTFs with graphics embedded to the database?

    tx Bernd

  • Additional info:

    The RTF itself is not changed when saving/restoring. The string, that goes to the DB is the same that is retrieved.

    I disconnected the TDBWPRichText from the datasource setting field/datasorce to Nil and the error does not pop up anymore.

    Below is the RTF that causes the trouble.

    (RTF removed, was truncated)

  • Additional info:
    I verified, that the data is not truncated.
    Edit/Save/Reload from the DB does not change the RTF.
    If I disconnect the control from the datafield, the error does not occur.
    If I edit the rtf with the editor component (see code below), no error occurs and the RTF is displayed ok.

  • Workaround:

    Do not set Datasource and Datafield of the TDBWPRichText.
    Create the form.
    Retrieve data.
    Set Datasource and Datafield (see code below).

    Code
    with TFrmTextbaustein.Create(CForm(Self)) do begin
      mlRTFText.DataSource:=frmTextbausteinList.dsTextbaustein;
      mlRTFText.DataField:='TEXTBAUSTEIN';
         if ShowModal=idOk then begin

    Conclusion: This must be a timing problem. Retrieveing data prior to having set properties, that influences the behaviour.