Title: Export DataSet To HTML
Question: help your export dataset to html
Answer:
function DataSet2HTML(DataSet: TDataSet): string;
var
intX: Integer;
strLine: string;
begin
if not Dataset.Active then dataset.Open;
DataSet.DisableControls;
// write header title
Result := '';
result := Result + '';
for intX := 0 to dataset.FieldCount-1 do
if DataSet.Fields[intX].Visible then
Result := Result + ''
+ ''
+ DataSet.Fields[intx].DisplayLabel
+ ''
+ '';
Result := Result + '';
// write each item
DataSet.First;
while not DataSet.Eof do
begin
strLine := '';
for intX := 0 to DataSet.FieldCount-1 do
if DataSet.Fields[intX].Visible then
strLine := strLine +''
+ DataSet.Fields[intx].Text
+ '';
strLine := strLine + '';
Result := Result + strLine;
DataSet.Next;
end;
// ok
Result := Result + '';
DataSet.EnableControls
end;