Is there a purely xHarbour procedure/method/function/lib that can read
in an Excel .wks file, and then build a .dbf file from the contents of this
.xls file ?
(I was reminded on anther newsgroup about an older ClipWks function from
Clipper 5.2e that apparently performed that function . Was it ever converted
to xHarbour ? )
TIA,
-Mel Smith
Try this... pass full source and target names including path
#define xLdbf3 8
**********************************************
FUNCTION XLS2DBF( cXlsName, cDbfName )
*
* Purpose: convert an Excel spreadsheet to a dBase III+ table
LOCAL oExcel := CREATEOBJECT( "Excel.Application" )
LOCAL oWorkBook, oSheet
oWorkBook := oExcel:WorkBooks:Open( cXlsName )
oSheet:SaveAs( cDbfName, xlDbf3 )
oWorkBook:Close( .f. )
oExcel:Quit()
RETURN( NIL )
*
-- Robert
Hi Mel,
Yes, ClipWks was converted for use with xharbour. You should see a
"BCClipWks.lib" file in your xharbour lib folder. In fact I used to
use it for my Excel spreadsheets until I switched to using the oExcel
calls as I wanted to perform more then what ClipWks could handle.
The documentation is the same as the orignial.
Mack
Thanks for the help !!
I'll look at both those solutions tomorrow.
Thanks again !
-Mel Smith
>
I don't remember where to find it but I have the files if you cannot
find them.
>
> Yes, ClipWks was converted for use with xharbour. You should see a
> "BCClipWks.lib" file in your xharbour lib folder. In fact I used to
> use it for my Excel spreadsheets until I switched to using the oExcel
> calls as I wanted to perform more then what ClipWks could handle.
>
> The documentation is the same as the orignial.
Mack:
I don't have that bcclipwks.library in my xharbour\lib\directory.
I would appreciate your sending it to me at the following (coded) email
address:
medsyntel at aol dot com
Thanks a lot.
btw, I tried the pure ole way (from Robert Campsmith above) this afternoon
and got caught with the following error:
Error TOLEAUTO/-1 CO_E_CLASSSTRING: TOLEAUTO:NES
Arguments ([1]= Type: C Val: Excel:application)
From my tiny test app here are the error lines
ToleAuto: NEW(296) in module win32ole.prg
NEW(308) in module win32ole.prg
Anyway, may bccclpwks.lib will serve my purpose ??
Thanks again.
-Mel Smith
Robert:
Apparently, one must have 'Excel' installed on their machine in order to
use your method.
So, I have to find another method (and I stlll havn't got the clipwks
library here to work with :)) )
I'm surprised that with all the other contributions offered, that no
guru has built an xls2dbf utility for xHarbour.
Anyway, thanks for trying to help !
-Mel Smith
> Apparently, one must have 'Excel' installed on their machine in order
> to use your method.
>
> So, I have to find another method (and I stlll havn't got the clipwks
> library here to work with :)) )
>
> I'm surprised that with all the other contributions offered, that no
> guru has built an xls2dbf utility for xHarbour.
Try this using ADO:
FUNCTION MAIN()
LOCAL oCn := CREATEOBJECT( "ADODB.Connection" )
oCn:Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=e:\xharbour\mysheet.xls;Extended Properties='Excel 8.0'" )
oCn:Execute( "SELECT * INTO [DBASE III; Database=e:\xharbour].mydbf FROM
[Sheet1$]" )
oCn:Close()
RETURN NIL
EMG
--
EMAG Software Homepage: http://www.emagsoftware.it
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg
The EMG Music page: http://www.emagsoftware.it/emgmusic
Hi Mel,
What version of xharbour are you using? If you are using xharbour
99.50, then this is the link: http://www.the-holms.org/new_clipwks.zip
If you are using xharbour v99.70 than I can zip up the files and send
them to you along with the documentation.
Gale is corret when she indicated that even though ClpWks has been re-
compiled so that it can work with xharbour, it will only support the
creation of Excel spreadsheets up to version 4, as well as not create
a spreadsheet with more than 8132 rows. This is the main reason I had
to switch to the oExcel method (as I was creating spreadsheets with
more than 30,000 rows but less than 65,535 which is the limit of rows
per tab for Excel 2002). Being able to use oExcel, gave more control
over formatting my spreadsheets with column headings, wordwrap and
this one is a neat, saving a dbf file as a spreadsheet even if it has
a memo field with the full contents of the memo field).
Mack
--
Regards
--------------------------------------
Gerald Drouillard
Technology Architect
Drouillard & Associates, Inc.
http://www.Drouillard.ca
You are correct, one must have the actual Excel program
installed for this method to work. For those without Excel,
I can export a dbf as .CSV, but I don't know how to do it in
reverse, sorry.
-- Robert