Ver Mensaje Individual
  #2  
Antiguo 02-05-2012
Avatar de kapcomx
kapcomx kapcomx is offline
Miembro
 
Registrado: jun 2007
Ubicación: Puebla México
Posts: 350
Reputación: 17
kapcomx Va por buen camino
raro...

Amigo axel he hecho algunas importaciones de Excel y nunca he tenido problemas, te dejo un ejemplo donde paso el contenido de una hoja excel a un stringgrid a ver si te sirve..


Código Delphi [-]
 
procedure Tformma.abrirClick(Sender: TObject);
var
   i: integer;
begin
abrir.Execute ;
nombre:=abrir.FileName ;
  IF nombre='' THEN
 begin
 SHOWMESSAGE('NO SELECCIONO NINGUN ARCHIVO')  ;  
 end
 ELSE
 BEGIN
  Excelapplication1.Workbooks.Open(nombre,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,Empty  Param,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,0);
  Hoja := Excelapplication1.Worksheets.Item[1] as _WorkSheet;
   i := 1;
   si :='1';
     for I := 1 to Stringgrid1.RowCount - 1 do
     Stringgrid1.Rows[i].Clear;
     stringgrid1.ColCount:=20;
     stringgrid1.RowCount:=1000;
   //*****
    with StringGrid1 do
     begin
       // Título de las columnas
        Cells[0, 0] := '' ;
        Cells[1, 0] := 'A' ;
        Cells[2, 0] := 'B' ;
        Cells[3, 0] := 'C' ;
        Cells[4, 0] := 'D' ;
        Cells[5, 0] := 'E' ;
        Cells[6, 0] := 'F' ;
        Cells[7, 0] := 'G' ;
        Cells[8, 0] := 'H' ;
        Cells[9, 0] := 'I' ;
        Cells[10, 0] := 'J' ;
        Cells[11, 0] := 'K' ;
        Cells[12, 0] := 'L' ;
        Cells[13, 0] := 'M' ;
        Cells[14, 0] := 'N' ;
        Cells[0,1] := '1' ;

        for i:=1 to 1000 do
        begin
           si := IntToStr(i);
           Cells[0,I] := SI;
           Cells[1,i] := Hoja.Range['a'+si,'a'+si].Value2;
           Cells[2,i] := Hoja.Range['b'+si,'b'+si].Value2;
           Cells[3,i] := Hoja.Range['c'+si,'c'+si].Value2;
           Cells[4,i] := Hoja.Range['d'+si,'d'+si].Value2;
           Cells[5,i] := Hoja.Range['e'+si,'e'+si].Value2;
           Cells[6,i] := Hoja.Range['f'+si,'f'+si].Value2;
           Cells[7,i] := Hoja.Range['g'+si,'g'+si].Value2;
           Cells[8,i] := Hoja.Range['h'+si,'h'+si].Value2;
           Cells[9,i] := Hoja.Range['i'+si,'i'+si].Value2;
           Cells[10,i] := Hoja.Range['j'+si,'j'+si].Value2;
           Cells[11,i] := Hoja.Range['k'+si,'k'+si].Value2;
           Cells[12,i] := Hoja.Range['l'+si,'l'+si].Value2;
           Cells[13,i] := Hoja.Range['m'+si,'m'+si].Value2;
 
            // VarType( Excelapplication1.Range['c'+si,'c'+si].Value2 ) = VarEmpty
        end;
        end;
 
end;
         StringGrid1.Visible :=True;
end;










Saludos...
__________________
un tipo al cual la sociedad no le tiene el mas mínimo respeto no puede ser presidente....
Responder Con Cita