Hi All,
Greetings. I found these codings in the Application Designer's Guide, Chapter 16.2. page 402.
CREATE(xlApp);
xlBook := xlApp.Workbooks.Add(-4167);
xlSheet := xlApp.ActiveSheet;
xlSheet.Name := 'Personnel Expenses';
xlSheet.Range('A2').Value := 'Administration';
xlSheet.Range('A3').Value := "G/L Entry".Amount;
I've tried on these codes and it'll only export one record.
Just wondering, is there any other way to export all the records in the table into excel format without using dataport? and using the similar way as mentioned above?
By the way, I'm using 3.01a.
Thanks.
Philip
Comments
Loop through the records as usual and make a variable 'counter' (type = integer) and add one to the counter and dynamicaly set the row in excel:
xlSheet.Range('A1').Value := 'Administration';
IF "G/L Entry".FIND('-') THEN BEGIN
REPEAT
Counter := Counter + 1;
xlSheet.Range('B' + FORMAT(Counter)).Value := "G/L Entry".Amount;
UNTIL "G/L Entry".Next := 0;
END;
I did not test it but with this code youre close it think
I don't want to bitch about your code, but I thinks you could improve it a bit by using a "INCSTR" instead of an integer variable.
* Code haven't been tested.
If it was hard to write, it should be hard to understand."
- you are doing INCSTR(Cell) and Cell is an array?
- for every record you fill the array with the same data? Can be done before the repeat.
- you are always filling the same cells (A1 and B1)?
- INCSTR is a more lengthy routine then format because it has to search for te start of the number, convert it to integer, increase it and then convert it back to text. (ok who will notice on todays machines :? )
I don't think it is an improvent.
Don't make easy things difficult.
Thanks for your help!! Your codings works
... if your goal is to create a chart in excel you might want to have a look at Embedded Controls ...