>>>What they want,is a text file that looks exactly like the report output from the report writer (minus the fonts, boldface, color, etc...). So, a CSV won't help me in this case.
>>>
>>>This has been done by outputting to a method that creates the textfile from the top down, line by line using FPUTS.
>>>
>>>As for the EXCEL spreadsheet, they want to have the option when selecting output to choose spreadsheet. So, when this is chosen, the above metioned textfile could be output automatically into EXCEL format (so they won't have to input it and then save as....).
>>>
>>>But, I need some sample code that detects if EXCEL is installed, and if so, to read in the textfile and then output it line by line as a spreadsheet.
>>>
>>>Thanks!
>>
>>Did you see a new previewer from Cesar Chalom? It allows to output report to any possible format.
>>
>>
http://weblogs.foxite.com/vfpimaging/archive/2010/01/31/10127.aspx>>
>>VFP9, though :(
>
>I'm keeping that link, in case we go to VFP 9 in the future.... looks like we are going dotNET sooner though!
Hi,
to check if Excel is installed you could make use of following:
llOK=.T.
TRY
loExcel=CreateObject('excel.application')
CATCH
llOK=.F.
ENDTRY
IF NOT llOK
MESSAGEBOX('Excel could not be started')
RETURN
ENDIF
So if Excel is installed copy the contents of your text file to a cursor. Next step is to copy the cursor to an Excel (type xl5) file.
Regards,
Koen