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
  #3  
Antiguo 03-04-2012
LuisAlf:: LuisAlf:: is offline
Miembro
 
Registrado: nov 2009
Posts: 60
Poder: 17
LuisAlf:: Va por buen camino
Hola Ecfisa!

Antes que nada gracias por tu ayuda.

Sabes que estuve probando tu recomendación y me parece mucho mejor que todos esos try anidados...

El problema es que no pude solucionar nada! haaha

Código Delphi [-]
procedure Tform2.ExportaExcel(pStringGrid : TstringGrid; c0,r0,c1,r1 : Integer);
var ExLin, ExCol, i, Linea, AuxInteger : Integer;
    AuxFloat : Extended;
    AuxFecha : tDatetime;
    c : TCursor;
    Excel, ExcelDoc, WS : Variant;
begin
  c             := Screen.Cursor;
  Screen.Cursor := crHourGlass;
  with pStringGrid do begin
    try
      coinitialize(nil);
      Excel         := CreateOleObject('Excel.Application');
      ExcelDoc      := Excel.Workbooks.Add;
      WS            := ExcelDoc.ActiveSheet;
      Excel.Visible := true;
      ExCol         := 0;
      for i := c0 to c1 do begin
        inc(ExCol);
        ws.Cells.Item[1, ExCol]:= cells[i, 0];
      end;

      for linea := r0 to r1 do begin
        inc(ExLin);
        ExCol := 0;
        for i := c0 to c1 do begin
          inc(ExCol);

          if TryStrToInt(StringGrid1.Cells[i, linea-1], AuxInteger) then
            ws.Cells.Item[ExLin, ExCol] := AuxInteger
          else if TryStrToFloat(StringGrid1.Cells[i, linea-1],AuxFloat) then
            ws.Cells.Item[ExLin, ExCol]:= AuxFloat
          else
            ws.Cells.Item[ExLin, ExCol]:= StringGrid1.Cells[i,linea-1];
           //showmessage(ws.Cells.Item[ExLin, ExCol]);
        end;
      end;
       ws.cells.entirecolumn.autofit;
    finally
      screen.Cursor := c;
    end;

  end;//del with
end;

Ya no salta error pero no me exporta correctamente... decidí darme a la busqueda de otras soluciones y encontre una, por medio de la ayuda de OLE... Como lo explica muy claramente roman en este hilo:

http://www.clubdelphi.com/foros/showthread.php?t=22649

Bueno muchas gracias de cualquier forma!
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
Abrir un archivo excel en un stringgrid con Lazarus IDE jejo1984 Lazarus, FreePascal, Kylix, etc. 9 16-01-2012 14:46:49
Importar datos de Excel a un StringGrid. ingabraham Varios 4 19-06-2011 00:49:00
StringGrid con columnas igual al de un archivo Excel J@ckie Conexión con bases de datos 3 01-03-2011 15:07:20
Exportar Stringgrid a Excel santipeich C++ Builder 9 15-06-2008 06:12:47


La franja horaria es GMT +2. Ahora son las 16:41:51.


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