为什么我在交叉数据表中针对不同的数据类型进行格式化,却在打印预览的时候一点作用都没有呢。例如:
procedure TForm_dlzdy.frRepPrintColumn(ColNo: Integer; var Width: Integer);
var
Field: TField;
begin
Field := Query.Fields[ColNo - 1];
if Field is TStringField then
Width := Field.Size * Canvas.TextWidth('W')
else if Field is TDateTimeField then
begin
Width := 8 * Canvas.TextWidth('W');
*** TfrMemoView(frRep.FindObject('Memo2')).FormatStr := 'YYYY-MM-DD';
end
else if Field is TFloatField then
begin
Width := 100;
*** TfrMemoView(frRep.FindObject('Memo2')).FormatStr := 'N,0.00';
end
else
Width := 64;
FWidth := Width;
end;格式化后不起作用,请注意打星号的代码。
procedure TForm_dlzdy.frRepPrintColumn(ColNo: Integer; var Width: Integer);
var
Field: TField;
begin
Field := Query.Fields[ColNo - 1];
if Field is TStringField then
Width := Field.Size * Canvas.TextWidth('W')
else if Field is TDateTimeField then
begin
Width := 8 * Canvas.TextWidth('W');
*** TfrMemoView(frRep.FindObject('Memo2')).FormatStr := 'YYYY-MM-DD';
end
else if Field is TFloatField then
begin
Width := 100;
*** TfrMemoView(frRep.FindObject('Memo2')).FormatStr := 'N,0.00';
end
else
Width := 64;
FWidth := Width;
end;格式化后不起作用,请注意打星号的代码。
TNumericField(ADOQuery.Field('memo2')).DisplayFormat:='##0.00'
Memo什么类型都有可能,因为它是交叉数据表,也就是说动态的确定字段的个数和不同字段对应不同的类型