SoloCodigo

Programación General => Visual FoxPro => Mensaje iniciado por: mrrobert en Martes 25 de Febrero de 2003, 23:34

Título: Re: exportar a excel
Publicado por: mrrobert en Martes 25 de Febrero de 2003, 23:34
Hola a todos.
Miren, tengo un sistema que hice con VFP 6, tomando la bases de datos generada en genexus en el sistema original.
En una grilla muestro los registros resultados de una consulta.
Ahora, estos registros necesito exportarlos a Excel.

Como lo hago y cual es el codigo?.
Espero puedan ayudarme.

Chau!:D
Título: Re: exportar a excel
Publicado por: Plinio en Sábado 15 de Marzo de 2003, 16:43
Si lo que necesitas es exportar tablas desde visual foxpro a Excel usa la opción "Exportar"desde el Menú Archivo.
Título: exportar a excel
Publicado por: paoluccij en Jueves 3 de Abril de 2003, 02:54
UNA VEZ ABIERTA LA TABLA CON LOS DATOS A EXPORTAR UTILIZA ESTE COMANDO

EXPOR TO C:NOMBRE_ARCHIVO TYPE XLS

SALUDOS
PAOLUCCI
Título: Re: exportar a excel
Publicado por: jls en Domingo 22 de Febrero de 2004, 02:25
Prueba con esto :
*************************************

OleXls = CreateObject("Excel.Application")  && Iniciar EXCEL

OleXls.Workbooks.Add   && Crear Libro

&&& El libro se crea por defecto con tres hojas
&& Con esto creamos mas hojas

OleXls.Sheets.add   && Añadir hojas al libro
OleXls.Sheets.add
OleXls.Sheets.add

OleXls.Sheets.Item(1).Name = "Trimestre1"  && Nombre de la Hoja 1

OleXls.Sheets.Item(1).Cells(1,1).Value = "Enero"        && Asignar datos a las
OleXls.Sheets.Item(1).Cells(1,2).Value = "Febrero"
OleXls.Sheets.Item(1).Cells(1,3).Value = "Marzo"
OleXls.Sheets.Item(1).Cells(2,1).Value = 101
OleXls.Sheets.Item(1).Cells(2,2).Value = 102
OleXls.Sheets.Item(1).Cells(2,3).Value = 103


OleXls.Sheets.Item(2).Name = "Trimestre2"

OleXls.Sheets.Item(2).Cells(1,1).Value = "Abril"
OleXls.Sheets.Item(2).Cells(1,2).Value = "Mayo"
OleXls.Sheets.Item(2).Cells(1,3).Value = "Junio"
OleXls.Sheets.Item(2).Cells(2,1).Value = 201
OleXls.Sheets.Item(2).Cells(2,2).Value = 202
OleXls.Sheets.Item(2).Cells(2,3).Value = 203


OleXls.Sheets.Item(3).Name = "Trimestre3"

OleXls.Sheets.Item(3).Cells(1,1).Value = "Julio"
OleXls.Sheets.Item(3).Cells(1,2).Value = "Agosto"
OleXls.Sheets.Item(3).Cells(1,3).Value = "Septiembre"
OleXls.Sheets.Item(3).Cells(2,1).Value = 301
OleXls.Sheets.Item(3).Cells(2,2).Value = 302
OleXls.Sheets.Item(3).Cells(2,3).Value = 303


OleXls.Sheets.Item(4).Name = "Trimestre4"

OleXls.Sheets.Item(4).Cells(1,1).Value = "Octubre"
OleXls.Sheets.Item(4).Cells(1,2).Value = "Noviembre"
OleXls.Sheets.Item(4).Cells(1,3).Value = "Diciembre"
OleXls.Sheets.Item(4).Cells(2,1).Value = 401
OleXls.Sheets.Item(4).Cells(2,2).Value = 402
OleXls.Sheets.Item(4).Cells(2,3).Value = 403



OleXls.Sheets.Item(5).Name = "Trimestre5"

OleXls.Sheets.Item(5).Cells(1,1).Value = "Pepe"
OleXls.Sheets.Item(5).Cells(1,2).Value = "Marcos"
OleXls.Sheets.Item(5).Cells(1,3).Value = "Ana"
OleXls.Sheets.Item(5).Cells(2,1).Value = 501
OleXls.Sheets.Item(5).Cells(2,2).Value = 502
OleXls.Sheets.Item(5).Cells(2,3).Value = 503


OleXls.Sheets.Item(6).Name = "Trimestre6"

OleXls.Sheets.Item(6).Cells(1,1).Value = "Papa"
OleXls.Sheets.Item(6).Cells(1,2).Value = "Mama"
OleXls.Sheets.Item(6).Cells(1,3).Value = "Tia"
OleXls.Sheets.Item(6).Cells(2,1).Value = 601
OleXls.Sheets.Item(6).Cells(2,2).Value = 602
OleXls.Sheets.Item(6).Cells(2,3).Value = 603

OleXls.ActiveWorkbook.Saveas("c:\tmp\prueba.xls")  && Guardar Hoja de Calculo

OleXls.quit