From: Paul Gibson
To: Samir H.
Visual FoxPro 9 SP2
Microsoft Office Automation
Wednesday, March 27, 2013 1:35:38 PM
This message was rated by:
> > This is just a general question of the community.
> > For a few versions now Excel has defaulted it's file block settings to stop users opening Excel files that are worksheet v4, v3 and, most importantly to us, v2. By default VFP exports to a Microsoft Excel version 2.0 worksheet file if using the COPY TO ... TYPE XLS command but can export to a Microsoft Excel version 5.0 workbook file if using the XL5 clause instead of XLS clause. Does the community generally stay away from the XLS clause now and use the XL5 clause instead.
> > As some regular readers may know I primarily code in a huuuuuge, mature application that has been around for more than 12 years now in it's current VFP code (long before that in previous versions of Fox). The application has literally hundreds of custom reports, written by dozens of different coders and generally when producing an Excel copy (as well as the paper copy) they have used the COPY TO ... TYPE XLS command to initially export the data before performing automation to manipulate the exported file (essentially to Beautify the data) and do some other stuff.
> > When users install the more recent versions of Excel we help them relax their Trust Centre defaults to allow our application to do it's stuff without Excel throwing a spanner in the works.
> > Obviously we could make things better/easier for ourselves by using the XL5 clause instead of XLS but a quick search across the application has found 304 occurrences of the clause TYPE XLS in 253 locations and I'd be reluctant to perform that kind of sweeping change without having a full knowledge of the ramifications.
> > I know the change to XL5 seems to handle dates slightly differently, for example:
> > v2 29-Feb-04 31-Dec-12 23:59:59 > > v5 29/02/2004 31/12/2012 23:59:59
> > Are there any gotchas or things I would need to know if I was switching between XLS and XL5 across the application?
> > Thanks for your time.
> I'm not answering you question, but while you're planing to change that, why not use a constant for the TYPE clause. You could then easily reverse changes if necessary (or if a new TYPE clause is added in VFP10, you'll be ready :) ).
That is a very good idea Samir, will consider that for any future implementations I carry out in this area.
Posted by Paul Gibson @ 3/27/2013 11:50:59 AM
Posted by Samir H. @ 3/27/2013 1:11:38 PM
Posted by Paul Gibson @ 3/27/2013 1:35:38 PM
Posted by Tamar Granor @ 3/27/2013 9:46:11 PM
Posted by Anders Altberg @ 3/28/2013 12:29:33 AM
Posted by Cetin Basoz @ 3/28/2013 1:38:14 AM