Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TFlistadoLlamadas.Button1Click(Sender: TObject);
- var
- workBook : _WORKBOOK;
- workSheet : _WORKSHEET;
- i,b,c: Integer;
- begin
- try
- barraProgreso.Min := 0;
- i := 4;
- //Columnas: Numero, Fecha, Duracion, Extension, Celular, Ent. o Sal., Usuario, Linea
- workBook := Excel.Workbooks.Add(NULL,0);
- workSheet := workBook.Sheets[1] as _WORKSHEET;
- workSheet.Cells.Item[1,1].ColumnWidth := 2;
- workSheet.Cells.Item[2,3]:='Reporte de llamadas realizadas.';
- workSheet.Cells.Item[2,3].font.size:=16;
- workSheet.Cells.Item[4,2] := 'Numero';
- workSheet.Cells.Item[4,2].ColumnWidth := 30;
- workSheet.Cells.Item[4,3] := 'Fecha';
- workSheet.Cells.Item[4,3].ColumnWidth := 30;
- workSheet.Cells.Item[4,4] := 'Duracion';
- workSheet.Cells.Item[4,2].ColumnWidth := 10;
- workSheet.Cells.Item[4,5] := 'Extension';
- workSheet.Cells.Item[4,5].ColumnWidth := 10;
- workSheet.Cells.Item[4,6] := 'Celular';
- workSheet.Cells.Item[4,6].ColumnWidth := 20;
- workSheet.Cells.Item[4,7] := 'Ent. o Sal. ';
- workSheet.Cells.Item[4,7].ColumnWidth := 20;
- workSheet.Cells.Item[4,8] := 'Usuario';
- workSheet.Cells.Item[4,8].ColumnWidth := 10;
- workSheet.Cells.Item[4,9] := 'Linea';
- workSheet.Cells.Item[4,9].ColumnWidth := 13;
- max := DBGridDetalles.DataSource.DataSet.RecordCount;
- ShowMessage(IntToStr(max));
- barraProgreso.Max := max;
- barraProgreso.Visible := true;
- with ZQDetalles do
- begin
- First;
- while not EOF do
- begin
- i := i + 1;
- workSheet.Cells.Item[i,2] := DBGridDetalles.Fields[0].AsString;
- Next;
- barraProgreso.StepIt;
- end;
- end;
- for b := 4 to i do
- begin Worksheet.Range['b'+IntToStr(b),'b'+IntToStr(b)].BorderAround(xlContinuous,xlTransparent,xlAutomatic,EmptyParam); Worksheet.Range['c'+IntToStr(b),'c'+IntToStr(b)].BorderAround(xlContinuous,xlTransparent,xlAutomatic,EmptyParam); Worksheet.Range['d'+IntToStr(b),'d'+IntToStr(b)].BorderAround(xlContinuous,xlTransparent,xlAutomatic,EmptyParam); Worksheet.Range['e'+IntToStr(b),'e'+IntToStr(b)].BorderAround(xlContinuous,xlTransparent,xlAutomatic,EmptyParam); Worksheet.Range['f'+IntToStr(b),'f'+IntToStr(b)].BorderAround(xlContinuous,xlTransparent,xlAutomatic,EmptyParam); Worksheet.Range['g'+IntToStr(b),'g'+IntToStr(b)].BorderAround(xlContinuous,xlTransparent,xlAutomatic,EmptyParam);
- end;
- barraProgreso.Visible := false;
- finally
- Excel.Visible[1]:=true;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement