<< Click to Display Table of Contents >> Navigation: Delphi HTML Report Library > Using reports in Delphi > Passing parameters to report |
Passing XML data:
Example:
Animals:= THtXMLNode.Create('<animals><animal name="Dog" color="yellow"/>'+
'<animal name="Bird" color="green"/></animals>');
R := THtReportDocument.Create;
try
R.RegisterVariable('animals', Animals, true);
R.Parse(TemplateText);
s := R.Render;
finally
R.Free
end;
Passing Delphi objects
For converting Delphi object to XML using RTTI (2010+) there are two functions in htxml unit:
ObjecttoXML(const O: TObject; ClassProp: boolean = false; Node: THtXMLNode = nil; UpperCaseName: boolean = true): THtXMLNode
RecordtoXML(const R; RecTypeInfo: pointer; ClassProp: boolean = false): THtXMLNode
Passing JSON
To pass JSON data to report use THtXMLNode.CreatefromJSON and pass created object via RegisterVariable function.