Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 12-07-2012
edgar_prospero edgar_prospero is offline
Miembro
NULL
 
Registrado: mar 2012
Posts: 202
Poder: 15
edgar_prospero Va por buen camino
sumar columna en excel

que hay tengo un problemilla, haber quien mepuede echar la mano estoy exportando una informacion a excel pero no se como hacerle para que me sume una columna ya que no siempre es el mismo rango varia dependiendo la consulta acontinuacion pongo mi codigo para ver donde puedo agregar para que me sume una columna

Código Delphi [-]
procedure TForm5.BitBtn6Click(Sender: TObject);
var Excel : Variant;
var Libro : Variant;
var i:integer;
var j:integer;
begin

Excel := CreateOleObject ('Excel.Application');


Excel.Visible := True;

Excel.WorkBooks.Add (-4167);

Excel.WorkBooks[1].WorkSheets[1].Name := 'Reporte';

Libro := Excel.WorkBooks[1].WorkSheets['Reporte'];
excel.worksheets[1].Range['B1','B1'].ColumnWidth :=45;
excel.worksheets[1].Range['C1','C1'].ColumnWidth :=13;
excel.worksheets[1].Range['D1','E1'].ColumnWidth :=15;
excel.worksheets[1].Range['F1','F1'].ColumnWidth :=16;
excel.worksheets[1].Range['G1','H1'].ColumnWidth :=9;
excel.worksheets[1].Range['I1','I1'].ColumnWidth :=14;
Libro.Cells.Item[1,1].Font.Bold:=True;
Libro.Cells.Item[1,1].font.size:=16;

Libro.Cells.Item[2,1]:= ' Inventario en proceso del departamento: '+dep2.Text + '  A  ' +dep3.Text;
Libro.Cells.Item[2,1].Font.Bold:=True;

Libro.Cells.Item[3,1].Font.Bold:=True;
Libro.Cells.Item[3,2].Font.Bold:=True;
Libro.Cells.Item[3,3].Font.Bold:=True;
Libro.Cells.Item[3,4].Font.Bold:=True;
Libro.Cells.Item[3,5].Font.Bold:=True;
Libro.Cells.Item[3,6].Font.Bold:=True;
Libro.Cells.Item[3,7].Font.Bold:=True;
Libro.Cells.Item[3,8].Font.Bold:=True;
Libro.Cells.Item[3,9].Font.Bold:=True;



Query.Open;
i:=2;

query.SQL.Clear;
query.SQL.Add('SELECT * FROM arm0062 WHERE departamento>=:inidep and departamento<=:findep and tipo_material>=:inimat and tipo_material<=:finmat order by  codigo asc ');

query.ParamByName('inidep').Asstring:=inidep.Text;
query.ParamByName('findep').Asstring:=findep.Text;
query.ParamByName('inimat').Asstring:=inimat.Text;
query.ParamByName('finmat').Asstring:=finmat.Text;
query.Open;

while not Query.EOF do
begin

Libro.Cells [1,1] := 'CLASIC AND BASIC SA DE CV';
Libro.Cells [3,1] := 'codigo';
Libro.Cells [3,2] := 'Nombre';
Libro.Cells [3,3] := 'departamento';
Libro.Cells [3,4] := 'tipo de material';
Libro.Cells [3,5] := 'cantidad piezas';
Libro.Cells [3,6] := 'cantidad material';
Libro.Cells [3,7] := 'unidad';
Libro.Cells [3,8] := 'costo';
Libro.Cells [3,9] := 'total';


i :=i+1;
Libro.Cells [i,1] := Query.FieldByName ('codigo').AsString;
Libro.Cells [i,2] := Query.FieldByName ('nombre').AsString;
Libro.Cells [i,3] := Query.FieldByName ('departamento').AsString;
Libro.Cells [i,4] := Query.FieldByName ('tipo_material').AsString;
Libro.Cells [i,5] := Query.FieldByName ('cant_piezas').AsString;
Libro.Cells [i,6] := Query.FieldByName ('cant_material').AsString;
Libro.Cells [i,7] := Query.FieldByName ('unidad').AsString;
Libro.Cells [i,8] := Query.FieldByName ('costo').AsString;
Libro.Cells [i,9] := Query.FieldByName ('total').AsString;

Query.Next;

end;

Query.Close;
end;
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
sumar columna Memo6015 OOP 11 27-01-2011 02:06:33
sumar columna sql anubis SQL 8 29-12-2010 01:59:44
Sumar Columna en StringGrig carlosh2006 Varios 2 28-08-2007 03:23:53
Sumar columna de un dbgrid Choclito Varios 0 24-07-2006 07:47:08
sumar columna de un dbgrid jpcancino Conexión con bases de datos 4 11-03-2004 16:33:37


La franja horaria es GMT +2. Ahora son las 23:55:05.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi