WPTools Variables can not be save

  • for example:

    procedure TForm1.Button1Click(Sender: TObject);
    var
    Item:TWPRTFExtraDataItem;
    begin
    WPRichText1.RTFVariables.Strings['abc']:='a';
    WPRichText1.RTFVariables.Strings['def']:='a';
    Item:=WPRichText1.RTFVariables.Find('abc');
    Item.Mode:=wpxData;
    Item.LoadFromFile('e:\abc.txt');
    WPRichText1.SaveToFile('e:\cs.wpt');
    end;

    then,Reopen Application ,Use the code:

    procedure TForm1.Button2Click(Sender: TObject);
    var
    Item:TWPRTFExtraDataItem;
    begin
    WPRichText1.LoadFromFile('e:\cs.wpt');
    Item:=WPRichText1.RTFVariables.Find('abc',wpxData);
    if Item<>nil then
    begin
    Item.SaveToFile('e:\a.txt');
    end;
    end;

    the item is nil,but the variable 'def' exists。

  • After the study,I found the unit file WPIOWptools.pas, 1636 line,
    Not processing the wpxData variable,
    This code:

    else if aTag.NameEqual ('variable') then / / Load Stream Variable
    begin
    / / TODO
    end
    I hope that you improve this code.