Ver Mensaje Individual
  #22  
Antiguo 30-04-2004
candido candido is offline
Miembro
 
Registrado: may 2003
Posts: 11
Reputación: 0
candido Va por buen camino
muchas gracias Roman, pero esta opcion no me vale porque no uso el objeto de delphi ExcelApplication, si no que lo creo mas o menos asi

---------------------------
Código Delphi [-]
     try
        XL := GetActiveOleObject('Excel.Application');
        //XL := GetActiveOleObject(DirBaseDatos + '\Plantillas\Etiquetas\etiquetas.xls');
     except
       XL := CreateOLEObject('Excel.Application');     // Ole object creation
       //XL := CreateOLEObject(DirBaseDatos + '\Plantillas\Etiquetas\etiquetas.xls');
     end;
     //XL.WorkBooks.add;
     if Ruta <> '' then
       XL.WorkBooks.open(Ruta)
     else
     XL.WorkBooks.add;     
     //XL.visible:=true;
     XL.visible:=False;

     j := 1;
     i := 0;
     while i < NoCampos do
     begin
        XArr[i+1]:=EXQuery.Fields[i].DisplayLabel;
        i := i+1;
        EXQuery.Next;
     end;
     XL.Range['A'+IntToStr(j),
     CHR(64+NoCampos)+IntToStr(j)].Value := XArr;

     XL.Range['A1',CHR(64+NoCampos)+IntToStr(j)].select;
     XL.Selection.Font.Name:='Times New Roman';
     XL.Selection.Font.Size:=10;
     XL.Selection.Font.color := clblue;
     XL.Selection.Font.bold := true;
     XL.Selection.Font.underline := true;


     j := 3;
     EXQuery.First;
     while not EXQuery.Eof do
     begin
       i:=1;
       while i<=NoCampos do
       begin
             XArr[i] := EXQuery.Fields[i-1].Value;
             i := i+1;
       end;
       XL.Range['A'+IntToStr(j),
         CHR(64+NoCampos)+IntToStr(j)].Value := XArr;
       EXQuery.Next;
       j := j + 1;
     end;
     XL.Range['A1',CHR(64+NoCampos)+IntToStr(j)].select;
     XL.selection.Columns.AutoFit;
     XL.Range['A1','A1'].select;
     XL.Quit;

----------------------

pero al final me pide que si quiero grabar o no, y no se como decirle que me lo grabe directamente

un saludo
__________________
Me da pena que se admire el valor en la batalla;
menos mal que con los rifles no se matan las palabras.

Última edición por roman fecha: 07-09-2006 a las 17:50:00. Razón: Añadir etiqueta [delphi] para mayor legibilidad
Responder Con Cita