请问用什么报表制作工具可以直接到处到excel? ( 积分: 50 )

  • 主题发起人 主题发起人 toffen
  • 开始时间 开始时间
T

toffen

Unregistered / Unconfirmed
GUEST, unregistred user!
请问用什么报表制作工具可以直接导出到excel?
导出的excel格式是实现在excel里做好还是导出到excel时自动生成?
 
请问用什么报表制作工具可以直接导出到excel?
导出的excel格式是实现在excel里做好还是导出到excel时自动生成?
 
fastreport
自动生成
 
fastreport frOLEExcelExport
 
用友华表cell
 
To toffen
我的QQ:82780254
楼上几个控件导不能把全部信息(例如颜色,位置等)导出到Excel中。
可以写代码导出来
procedure ExportExcel(Title: String;
Handle: Thandle;
Qry: TADOQuery;
DB: TDBGridEh;
Flag: Integer);
var
Excel: Variant;
WorkBook: OleVariant;
WorkSheet: OleVariant;
I, J: Integer;
begin
try
if Qry.RecordCount = 0 then
begin
MessageBox(Handle, Mess98002, MessTitleCHN,
MB_ICONINFORMATION + MB_OK);
Exit;
end;
Excel := CreateOleObject('Excel.Application');
Excel.Application.Workbooks.add;
Excel.Caption := Title;
Excel.Application.Visible := True;

WorkBook := Excel.Application.WorkBooks[1];
WorkSheet := WorkBook.WorkSheets.Item[1];
except
MessageBox(Handle, Mess98003, MessTitleCHN,
MB_ICONINFORMATION + MB_OK);
Exit;
end;

case Flag of
1:
begin
I := 1;
Qry.First;
for J := 0 to DB.FieldCount - 1do
begin
WorkSheet.Cells[1, J + 1].HorizontalAlignment := 3;
WorkSheet.Cells[1, J + 1] := DB.Fields[J].DisplayName;
end;
while not Qry.Eofdo
begin
Inc(I);
for J := 0 to DB.FieldCount - 1do
begin
if (J = 0) or (J = 1) then
WorkSheet.Cells[I, J + 1].HorizontalAlignment := 2
else
WorkSheet.Cells[I, J + 1].NumberFormat := '0.00';
WorkSheet.Cells[I, J + 1] := DB.Fields[J].AsString;
end;
Qry.Next;
end;
end;

2:
begin
I := 1;
Qry.First;
for J := 0 to DB.FieldCount - 1do
begin
WorkSheet.Cells[1, J + 1].HorizontalAlignment := 3;
WorkSheet.Cells[1, J + 1] := DB.Fields[J].DisplayName;
end;
while not Qry.Eofdo
begin

Inc(I);

for J := 0 to DB.FieldCount - 1do
begin
if (J = 0) or (J = 1) or (J = 8) then
WorkSheet.Cells[I, J + 1].HorizontalAlignment := 2
else
begin
WorkSheet.Cells[I, J + 1].NumberFormat := 'hh:mm';
with FlagColordo
begin
case Qry.FieldByName('Flag' + IntToFlag(J - 1)).AsInteger of
FlagHols:
WorkSheet.Cells[I, J + 1].Interior.Color := ColorHols;
FlagEvection:
WorkSheet.Cells[I, J + 1].Interior.Color := ColorEvection;
FlagOvertime:
WorkSheet.Cells[I, J + 1].Interior.Color := ColorOvertime;
FlagAbsent:
WorkSheet.Cells[I, J + 1].Interior.Color := ColorAbsent;
FlagLate:
WorkSheet.Cells[I, J + 1].Interior.Color := ColorLate;
FlagEarly:
WorkSheet.Cells[I, J + 1].Interior.Color := ColorEarly;
FlagForget:
WorkSheet.Cells[I, J + 1].Interior.Color := ColorForget;
end;
end;
end;
if J = 8 then
begin
if Qry.FieldByName('IsRest').AsBoolean = True then
WorkSheet.Cells[I, J + 1] := '√'
else
WorkSheet.Cells[I, J + 1] := 'X';
WorkSheet.Cells[I, J + 1].HorizontalAlignment := 3;
end
else
WorkSheet.Cells[I, J + 1] := DB.Fields[J].AsString;
end;
Qry.Next;
end;
end;

3:
begin
I := 1;
Qry.First;
for J := 0 to DB.FieldCount - 1do
begin
WorkSheet.Cells[1, J + 1].HorizontalAlignment := 3;
WorkSheet.Cells[1, J + 1] := DB.Fields[J].DisplayName;
end;
while not Qry.Eofdo
begin

Inc(I);

for J := 0 to DB.FieldCount - 1do
begin
if (J < 2) then
WorkSheet.Cells[I, J + 1].HorizontalAlignment := 2;
if (J > 1) and (J < 14) then
WorkSheet.Cells[I, J + 1].NumberFormat := '0.00';
WorkSheet.Cells[I, J + 1] := DB.Fields[J].AsString;
end;
Qry.Next;
end;
end;

4:
begin
I := 1;
Qry.First;
for J := 0 to DB.FieldCount - 1do
begin
WorkSheet.Cells[1, J + 1].HorizontalAlignment := 3;
WorkSheet.Cells[1, J + 1] := DB.Fields[J].DisplayName;
end;
while not Qry.Eofdo
begin
Inc(I);
for J := 0 to DB.FieldCount - 1do
begin
WorkSheet.Cells[I, J + 1].HorizontalAlignment := 2;
WorkSheet.Cells[I, J + 1] := DB.Fields[J].AsString;
end;
Qry.Next;
end;
end;

5:
begin
I := 1;
Qry.First;
for J := 0 to DB.FieldCount - 1do
begin
WorkSheet.Cells[1, J + 1].HorizontalAlignment := 3;
WorkSheet.Cells[1, J + 1] := DB.Fields[J].DisplayName;
end;
while not Qry.Eofdo
begin
Inc(I);
for J := 0 to DB.FieldCount - 1do
begin
if (J = 0) or (J = 8) then
WorkSheet.Cells[I, J + 1].HorizontalAlignment := 2;
WorkSheet.Cells[I, J + 1] := DB.Fields[J].AsString;
if J = 8 then
WorkSheet.Cells[I, J + 1].NumberFormat := '#';
if (J = 9) or (J = 10) then
WorkSheet.Cells[I, J + 1].NumberFormat := 'yyyy-mm-dd';
end;
Qry.Next;
end;
end;
end;
end;
 
好多控件都可以FR,DBGRIDEH,INFOWER等等
 
多人接受答案了。
 
后退
顶部