excel X ole

excel X ole

Postby cendon » Thu Oct 09, 2008 1:27 pm

Good morning friends,

I am making new attempt to try to solve a problem

some time to generate some reports in Excel using
what's more simple. A text file renamed to xls with chr (9) to separate the fields.

but was no longer given more my clients

passed the test with OLE

could generate up to the file. It was to have 1 single cell occupied, but he repeats the same content across spreadsheet.
Anybody know where is the error?

this is the source.

PS if anyone has a small example with Excel file created with OLE and can send me, I would be grateful

Thank you

/*
Generando um arquivo Excel
Angelo José Ferreira Cendon
*/

#include "FiveWin.ch"

FUNCTION Testaj()
LOCAL cFilexls := ".\arqexcel.xls"
LOCAL oExcel

msgalert("iniciando geração")

oExcel := TExcelScript():New()

msgalert("Criando script para excel")

oExcel:Create( cFilexls )
oExcel:Visualizar(.T.)
msgalert("Arquivo test1.xls criado - Partindo para entrada de dados")


oExcel:Font("Tahoma") // fonte de letra
oExcel:Size(10) // tamanho do fonte
oExcel:Align(1) // alinhamento a esquerda
oExcel:Say( 4 , 2 , 'Teste de geração excel' , , , .T.)
oExcel:Visualizar(.T.)

oExcel:End()

msgalert("K bo")
RETURN ( .T. )

Blessed are the pessimists, they did backups!

Angelo Cendon
cendon.angelo@gmail.com
Belo Horizonte-MG - Brasil
Fivewin 2.4 - Harbour 0,38 - @ l,c Workshop
cendon
 
Posts: 3
Joined: Thu Oct 02, 2008 1:12 pm

Re: excel X ole

Postby Enrico Maria Giordano » Thu Oct 09, 2008 3:38 pm

Code: Select all  Expand view
FUNCTION MAIN()

    LOCAL oExcel := CREATEOBJECT( "Excel.Application" )

    LOCAL oWorkbook := oExcel:Workbooks:Add()

    LOCAL oSheet := oExcel:ActiveSheet

    oSheet:Cells( 1, 1 ):Value = "This is a test"

    oExcel:Visible = .T.

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8378
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 33 guests