Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CODE TO PRODUCE XLS FORMAT 1

Status
Not open for further replies.

dkerta

Programmer
Feb 6, 2004
3
ID
Guys,

I need sample code in Clipper to generate output in Excel file type (XLS/SLK), any one can help?

Thanks
dkerta
 
Save the data to a DBF file. Open the DBF file in Excel and then save it as a .XLS.

My point is Excel is happy to open DBF's so why bother?

Ian Boys
DTE Systems Ltd
 
Good idea BOZZ.

dkerta, however, if you want to avoid even this extra operation, the synatax is:

.
.
.
SET SAFETY OFF
COPY TO FILENAME.XLS type XLS
SET SAFETY ON
.
.

End
 
AnanthaP,
Not sure what flavour of Clipper you are using but that sure don't work on Clipper 5.01 to 5.2e.

Ian Boys
DTE Systems Ltd
 
Hi Buddy,

I am awre that DBF fiel can be open throu Excel, but we're developing an automatic process to minimize user intervention by doing "save as" something. The batch program run at night and I'd like the program to generate XLS file which will be pulled out from other XLS file macro.

I have an error message when I use
COPY TO FILENAME.XLS type XLS
with error message:
ERROR C2005 statement not recognized, match failed at : 'type'

I am using CA-CLIPPER (R) 5.3

Any ideas?
 
I create reports in HTML format (<TABLE>). My Excel 2K can handle HTML very good; it is even possible to use <STYLE> codes. So you have some layout possibilities.
In Clipper you can output to HTML (ASCII) in various ways, the simplest a SET ALTERNATE TO <yourfile>. I usually output via low-level filefunctions (fcreate(), fwrite())



hth,
Foxbox
ttmug.gif
 
How about using an Excel macro to convert from DBF to XLS.

Ian Boys
DTE Systems Ltd
 
Thanks Guys...
All ideas are very helpfull. Finally, We're using a simple copy command to generate the XLS file. I was surprised when it works fine.

USE FileName.dbf
COPY TO FileName.Xls

That's all

C u
 
Thats to thank to the guys at the MS Excel development team, as they are *not* original MS developers, but MS bought Excel by eating some small firm, years ago. This sort of assured that the software is pretty decent developed ;-]
Excel just recognizes the fileformat when it opens an external file. The .xls extension connects to Excel trough Windows registry, and Excel does the rest ;-)

TIA
TonHu
 
Hi!

First of all, MSOffice XP and higher, perhaps 2000 too can read html code good. That means, if you create an html file with one table (html-body-table.../table-/body-/html), Excel will understand it as one, single sheet. That has been written above, and I can say, that works.

Second, I became the job to create an object file, containing an "object" (we have a unique system in Clipper, running everything via "objects"). This means, I have to create some code to produce xhtml and/or xls+doc code, with much-much options built in. The .obj (1 or 2), compiled with Clipper 5.2 will be free. (With reference, of course.)
 
Thank you DKERTA for this so simple solution.

I am getting great results using simple COPY TO fName.XLS

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top