FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#3
|
|||
|
|||
mira yo ago algo similar y encontre un procedimiento y solo le cambie algunas cosas y kedo de la siguiente forma:
no olvides insertar en tu form el componente excelAplication que se encuentra en la pestaña de servers. tambien en uses tienes que agregar los siguientes: comobj, Activex procedure ExportaExcel(pStringGrid : TstringGrid; c0,r0,c1,r1 : Integer); var ExLin, ExCol, i, Linea : Integer; 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); try ws.Cells.Item[ExLin,ExCol]:= cells[i,linea]; except end; end; end; ws.cells.entirecolumn.autofit; finally screen.Cursor := c; end; end; end; ya solo lo mandas llamar en donde tu kieras ya sea dando click en un boton y pones el siguiente codigo: ExportaExcel(Grid1, 0,0,Grid1.colCount,Grid1.RowCount); pruebalo a ver ke te parece. |
|
|
|