Ver Mensaje Individual
  #3  
Antiguo 19-12-2008
MiKloSS MiKloSS is offline
Miembro
 
Registrado: oct 2007
Posts: 27
Reputación: 0
MiKloSS Va por buen camino
Este es el codigo que utilizo para exportar, ya he intentado con :


//paleta server
ExcelApplication1.Visible[0] := True;

//OLE
Excel.Visible := True;

y ninguno me funciono, a lo mejor no puse bien la linea de codigo, podrias decirme en que parte se pone lo de visible... salu2

Código:
procedure TF_CatProductos.Exportar;
var
  Libro,Excel:variant;
  LineNumber, LCID : Integer;
  LineString : string;
  fila, columna: Integer;
  valorCelda: String;
  letra: String;
  arreglo:array[1..40] of integer;
  xband:boolean;
begin
  with SaveDialog1 do
    begin
      FileName :='';
      Filter:= 'Excel files|*.XLS;All Files|*.*';
      DefaultExt := 'XLS';
      Title := 'Exporting to Excel';
      if execute then
      begin
        LineNumber := 0;
        LCID := GetUserDefaultLCID;
        with ExcelApplication1 do
        begin
          connect;
          try
            visible[LCID] := false;
            Workbooks.Add(EmptyParam,LCID);
            with Range['A1','I1']do
            begin
              HorizontalAlignment := xlCENTER;
              VerticalAlignment := xlCENTER;
              Wraptext := false;
              Orientation := 0;
              ShrinkTofit := false;
              MergeCells := false;
              Font.Bold := true;
              FONT.Size:=11;
            end;
            //COLOCO EN ENCABEZADO DE LAS COLUMNAS
            Range['A1','I1'].Value2 := VarArrayOf(['PRODUCTO','CÓDIGO','DESCRIPCION','GRUPO','G.CTRL','EXISTENCIA','P.PRECIO','DESCUENTO','COMISION']);
            RANGE['A1','I1'].ColumnWidth := VarArrayOf([12,10,40,11,10,11,10,11,10]);
            Range['A1','I1'].Font.Bold := True;
            with range ['A1','A3000'] do
            begin
              numberformat:='0';
            end;
            QRY_BSARTICULOS.Close;
              if bandera=false then
                  QRY_BSARTICULOS.sql.text:='select * from articulos where existencia <> 0 order by descripcion';
              if bandera=true then
                 QRY_BSARTICULOS.sql.text:='select * from articulos order by descripcion';

            QRY_BSARTICULOS.Open;


            QRY_BSARTICULOS.First;
            BARRA.Visible:=true;
            barra.Max:=QRY_BSARTICULOS.RecordCount;
            barra.Visible:=true;
            columna:=2;
            // FOR columna:= 2 to QRY_BSARTICULOS.RecordCount-1 do
            while not QRY_BSARTICULOS.Eof do
            begin
              Cells.Item[columna,1].value:=QRY_BSARTICULOSID_ARTICULO.Value;
              cells.Item[columna,2].value:=QRY_BSARTICULOSAMECOP.Value;
              cells.Item[columna,3].value:=QRY_BSARTICULOSDESCRIPCION.Value;
              cells.Item[columna,4].value:=QRY_BSARTICULOSID_LINEA.Value;
              cells.Item[columna,5].value:=QRY_BSARTICULOSGRUPO_C.Value;
              cells.Item[columna,6].value:=QRY_BSARTICULOSEXISTENCIA.Value;
              cells.Item[columna,7].value:=QRY_BSARTICULOSPRECIO_PUBLICO.Value;
              cells.Item[columna,8].value:=QRY_BSARTICULOSDESCUENTO.Value;
              cells.Item[columna,9].value:=QRY_BSARTICULOSCOMISION.Value;
              columna:=columna+1;
              barra.Position:=BARRA.Position+1;
              QRY_BSARTICULOS.Next;
            end;
            ActiveWorkbook.SaveAs(FileName,xlNormal,'','',False,False,xlNoChange,xlUserResolution,False,EmptyParam,EmptyParam,LCID,0);
            Quit;
          finally
            disconnect;
          end;///try
        end;//with ExcelApplication1 do
      end;//if execute then
    end;//with SaveDialog1 do
    barra.Visible:=false;
end;
Responder Con Cita