You are not logged in.
Pages: 1
Hi all,
Can anybody help me with this?
How do I persist a TDocVariant object to a file?
Let's say I have this code:
aTemplate:variant;
TDocVariant.New(aTemplate);
aTemplate.Subject := 'some Subject';
aTemplate.Description := 'some Description';
// Persist aTemplate to file ...something like SaveToFile(someFileName);
Any help in the right direction much appreciated.
Cheers,
Wai
Last edited by wai-kit (2018-07-04 17:27:06)
fpcdeluxe, FPC 3.2 / Lazarus 2.0, mORMot on Windows 10 ...
Offline
Hi all,
Can anybody help me with this?
How do I persist a TDocVariant object to a file?
Let's say I have this code:aTemplate:variant;
TDocVariant.New(aTemplate);
aTemplate.Subject := 'some Subject';
aTemplate.Description := 'some Description';// Persist aTemplate to file ...something like SaveToFile(someFileName);
Any help in the right direction much appreciated.
Cheers,
Wai
procedure TForm1.Button1Click(Sender: TObject);
var
aTemplate: Variant;
begin
TDocVariant.New(aTemplate);
aTemplate.Subject := 'some Subject';
aTemplate.Description := 'some Description';
Memo1.Lines.Add( aTemplate );
// {"Subject":"some Subject","Description":"some Description"}
Memo1.Lines.Add( aTemplate.Subject );
// some Subject
Memo1.Lines.Add( aTemplate.Description );
// some Description
FileFromString( aTemplate, 'test.txt' );
// {"Subject":"some Subject","Description":"some Description"}
end;
Offline
Thank you very much for the help!!
That did the trick.
fpcdeluxe, FPC 3.2 / Lazarus 2.0, mORMot on Windows 10 ...
Offline
Pages: 1