My client runs a mature many-featured FPD application and I've been
asked to modify a couple of the PRG-generated reports. These reports use
?, no FRX involved, and are powered by cursors for the data. The reports
have numerous options driven by selector windows. Once the selections
are made, the user picks between Screen and Printer. I'm being asked to
include an option to create an Excel spreadsheet. I did something like
this for them a couple years ago. It was a bunch of work, but I came up
with a satisfactory solution. I thought I'd ask here before really
getting into this.

The printed version supports some stuff that I don't know how I'd
support in a spreadsheet. I mean, I can do a COPY TO FILE (lcFilename)
TYPE XLS, and if my fieldnames are sufficiently descriptive, it might be
satisfactory. But it would be nice if I could include nice things like a
page heading and a total line at the end. Is that stuff possible without
some weird kludge?

Re: FPD report help by Fred

Fred
Sat Feb 05 13:00:42 CST 2005

You could add the totals by adding a an additional record at the end with
the totals in it. Put it all in a cursor using a SELECT * FROM yourtable
INTO CURSOR yourcursor and then doing an INSERT INTO yourcursor (somefields)
VALUES (somevalues)

As far as the headers go, I don't think you can get there from here very
easily in FPD. VFP it would be a piece of cake via automation.

--
Fred
Microsoft Visual FoxPro MVP


"Dan_Musicant" <man@privacy.net> wrote in message
news:0d1a01po12mt7e013knn6humjp4339g57c@4ax.com...
> My client runs a mature many-featured FPD application and I've been
> asked to modify a couple of the PRG-generated reports. These reports use
> ?, no FRX involved, and are powered by cursors for the data. The reports
> have numerous options driven by selector windows. Once the selections
> are made, the user picks between Screen and Printer. I'm being asked to
> include an option to create an Excel spreadsheet. I did something like
> this for them a couple years ago. It was a bunch of work, but I came up
> with a satisfactory solution. I thought I'd ask here before really
> getting into this.
>
> The printed version supports some stuff that I don't know how I'd
> support in a spreadsheet. I mean, I can do a COPY TO FILE (lcFilename)
> TYPE XLS, and if my fieldnames are sufficiently descriptive, it might be
> satisfactory. But it would be nice if I could include nice things like a
> page heading and a total line at the end. Is that stuff possible without
> some weird kludge?



Re: FPD report help by Dan_Musicant

Dan_Musicant
Sat Feb 05 13:22:29 CST 2005

On Sat, 5 Feb 2005 12:00:42 -0700, "Fred Taylor"
<ftaylor@mvps.org!REMOVE> wrote:

:You could add the totals by adding a an additional record at the end with
:the totals in it. Put it all in a cursor using a SELECT * FROM yourtable
:INTO CURSOR yourcursor and then doing an INSERT INTO yourcursor (somefields)
:VALUES (somevalues)
:
:As far as the headers go, I don't think you can get there from here very
:easily in FPD. VFP it would be a piece of cake via automation.

Yeah, thanks Fred. My idea for the header is just to make that the name
of the spreadsheet! Thus for the sample report I just printed it would
be:

Active Inventory Evaluation for Finished Goods - All Inventory.xls !!!

Dan

Re: FPD report help by Dan_Musicant

Dan_Musicant
Sun Feb 06 08:16:55 CST 2005

On Sat, 05 Feb 2005 19:22:29 GMT, Dan_Musicant <man@privacy.net> wrote:

:On Sat, 5 Feb 2005 12:00:42 -0700, "Fred Taylor"
:<ftaylor@mvps.org!REMOVE> wrote:
:
::You could add the totals by adding a an additional record at the end with
::the totals in it. Put it all in a cursor using a SELECT * FROM yourtable
::INTO CURSOR yourcursor and then doing an INSERT INTO yourcursor (somefields)
::VALUES (somevalues)
::
::As far as the headers go, I don't think you can get there from here very
::easily in FPD. VFP it would be a piece of cake via automation.
:
:Yeah, thanks Fred. My idea for the header is just to make that the name
:of the spreadsheet! Thus for the sample report I just printed it would
:be:
:
:Active Inventory Evaluation for Finished Goods - All Inventory.xls !!!
:
:Dan

Hm, I now realize that FPD won't care to have a filename longer than 8
characters. Oh, well.


Re: FPD report help by Mike

Mike
Sun Feb 06 11:40:03 CST 2005

Hi Dan,
Are the requirements for your client's Excel request be that it be a
FPD based solution? Where I work, our main company wide applications
are all FPD based but we do our reporting and data extraction with
VFP8 and soon VFP9. With VFP you have the option of automating the
process entirely by opening Excel as an automation object and
controlling it via Foxpro. This gives you the best of both worlds,
your client gets to keep their legacy FPD app at the same time they
get the benefits of what can be done with VFP.

If this sounds like something you want to follow I recommend
"Microsoft Office Automation with Visual FoxPro" from Hentzenwerk. It
will get you a good explanation of how Office and FoxPro can work
together.
mike...

http://www.hentzenwerke.com/catalog/autofox.htm


On Sat, 05 Feb 2005 17:40:57 GMT, Dan_Musicant <man@privacy.net>
wrote:

>My client runs a mature many-featured FPD application and I've been
>asked to modify a couple of the PRG-generated reports. These reports use
>?, no FRX involved, and are powered by cursors for the data. The reports
>have numerous options driven by selector windows. Once the selections
>are made, the user picks between Screen and Printer. I'm being asked to
>include an option to create an Excel spreadsheet. I did something like
>this for them a couple years ago. It was a bunch of work, but I came up
>with a satisfactory solution. I thought I'd ask here before really
>getting into this.
>
> The printed version supports some stuff that I don't know how I'd
>support in a spreadsheet. I mean, I can do a COPY TO FILE (lcFilename)
>TYPE XLS, and if my fieldnames are sufficiently descriptive, it might be
>satisfactory. But it would be nice if I could include nice things like a
>page heading and a total line at the end. Is that stuff possible without
>some weird kludge?


Re: FPD report help by Dan_Musicant

Dan_Musicant
Mon Feb 07 10:53:32 CST 2005

On 6 Feb 2005 11:40:03 -0600, Mike McBride <mcmike@netcene.com> wrote:

:Hi Dan,
:Are the requirements for your client's Excel request be that it be a
:FPD based solution? Where I work, our main company wide applications
:are all FPD based but we do our reporting and data extraction with
:VFP8 and soon VFP9. With VFP you have the option of automating the
:process entirely by opening Excel as an automation object and
:controlling it via Foxpro. This gives you the best of both worlds,
:your client gets to keep their legacy FPD app at the same time they
:get the benefits of what can be done with VFP.
:
:If this sounds like something you want to follow I recommend
:"Microsoft Office Automation with Visual FoxPro" from Hentzenwerk. It
:will get you a good explanation of how Office and FoxPro can work
:together.
:mike...
:
:http://www.hentzenwerke.com/catalog/autofox.htm
:

Thanks, Mike. The guy who developed this FPD application over 10-12
years did do some things in VFP. He too wasn't employed by the company,
per se. He left and I was brought on (he showed me the ropes for a
couple of days) and I've been asked to keep the ship afloat, so to
speak. Occasionally, they ask me for enhancements, and this would fall
in that category.

It did occur to me that I could try to do this with Foxfire! or VFP. I
think it's a question of what would be most cost-effective, what would
save them the most money. I have to look at it from that perspective
right now. So, I figure I'll just try to adapt the printing routines to
export to Excel. That is, copy the printing procedures and turn them
into Excel export procedures, figuring that will take the least time. It
may not be spiffy in terms of headings and file names, but I think only
one or two people are apt to use these reports and they can surely learn
to live with the shortcomings. Hopefullly, that's going to prove to be
doable over the next couple of days.

Dan



:On Sat, 05 Feb 2005 17:40:57 GMT, Dan_Musicant <man@privacy.net>
:wrote:
:
:>My client runs a mature many-featured FPD application and I've been
:>asked to modify a couple of the PRG-generated reports. These reports use
:>?, no FRX involved, and are powered by cursors for the data. The reports
:>have numerous options driven by selector windows. Once the selections
:>are made, the user picks between Screen and Printer. I'm being asked to
:>include an option to create an Excel spreadsheet. I did something like
:>this for them a couple years ago. It was a bunch of work, but I came up
:>with a satisfactory solution. I thought I'd ask here before really
:>getting into this.
:>
:> The printed version supports some stuff that I don't know how I'd
:>support in a spreadsheet. I mean, I can do a COPY TO FILE (lcFilename)
:>TYPE XLS, and if my fieldnames are sufficiently descriptive, it might be
:>satisfactory. But it would be nice if I could include nice things like a
:>page heading and a total line at the end. Is that stuff possible without
:>some weird kludge?


Re: FPD report help by Andrew

Andrew
Tue Feb 08 02:31:30 CST 2005

Dan_Musicant wrote:
> It did occur to me that I could try to do this with Foxfire! or VFP. I
> think it's a question of what would be most cost-effective, what would
> save them the most money. I have to look at it from that perspective
> right now. So, I figure I'll just try to adapt the printing routines
> to export to Excel. That is, copy the printing procedures and turn
> them into Excel export procedures, figuring that will take the least
> time. It may not be spiffy in terms of headings and file names, but I
> think only one or two people are apt to use these reports and they
> can surely learn to live with the shortcomings. Hopefullly, that's
> going to prove to be doable over the next couple of days.
>
> Dan

I do that kind of export in FPW. However if I need to make a "more Excelly"
presentation then I make what I call a cover sheet - ie a sheet in Excel
with all the pretty headings and formatting with a load of links to the
plain data tables I export from Fox. The data tables get created in a "data"
subdirectory and the user just opens the cover sheet and updates links.

--
HTH
Andrew Howell



Re: FPD report help by Bernhard

Bernhard
Tue Feb 08 07:54:44 CST 2005

Hi Dan_Musicant

> Hm, I now realize that FPD won't care to have a filename longer than 8
> characters. Oh, well.
But you can
RUN XCOPY 8char.xls "very long File Name also with Spaces.xls"
or
RUN RENAME 8char.xls "very long File Name also with Spaces.xls"
right after your creation of the xls file. Don't forget the quotes if there are
special characters in the long file name.
This works in FPD which runs on a Windows with long filename support.

Regards
Bernhard Sander


Re: FPD report help by Fred

Fred
Tue Feb 08 09:20:18 CST 2005

Maybe you can use DDE? I've never tried that from FPD.

--
Fred
Microsoft Visual FoxPro MVP


"Andrew Howell" <ajh@work> wrote in message
news:ep95hibDFHA.1296@TK2MSFTNGP10.phx.gbl...
> Dan_Musicant wrote:
>> It did occur to me that I could try to do this with Foxfire! or VFP. I
>> think it's a question of what would be most cost-effective, what would
>> save them the most money. I have to look at it from that perspective
>> right now. So, I figure I'll just try to adapt the printing routines
>> to export to Excel. That is, copy the printing procedures and turn
>> them into Excel export procedures, figuring that will take the least
>> time. It may not be spiffy in terms of headings and file names, but I
>> think only one or two people are apt to use these reports and they
>> can surely learn to live with the shortcomings. Hopefullly, that's
>> going to prove to be doable over the next couple of days.
>>
>> Dan
>
> I do that kind of export in FPW. However if I need to make a "more
> Excelly"
> presentation then I make what I call a cover sheet - ie a sheet in Excel
> with all the pretty headings and formatting with a load of links to the
> plain data tables I export from Fox. The data tables get created in a
> "data"
> subdirectory and the user just opens the cover sheet and updates links.
>
> --
> HTH
> Andrew Howell
>
>



Re: FPD report help by Andrew

Andrew
Tue Feb 08 10:15:42 CST 2005

Fred Taylor wrote:
> Maybe you can use DDE? I've never tried that from FPD.
>

Thinking "maybe I can use DDE" is about as far as I got ;)

--
Regards
Andrew Howell



Re: FPD report help by Dan

Dan
Tue Feb 08 12:03:37 CST 2005

DDE is Windows-only.

Dan

Fred Taylor wrote:
> Maybe you can use DDE? I've never tried that from FPD.
>
>
> "Andrew Howell" <ajh@work> wrote in message
> news:ep95hibDFHA.1296@TK2MSFTNGP10.phx.gbl...
>> Dan_Musicant wrote:
>>> It did occur to me that I could try to do this with Foxfire! or
>>> VFP. I think it's a question of what would be most cost-effective,
>>> what would save them the most money. I have to look at it from that
>>> perspective right now. So, I figure I'll just try to adapt the
>>> printing routines to export to Excel. That is, copy the printing
>>> procedures and turn them into Excel export procedures, figuring
>>> that will take the least time. It may not be spiffy in terms of
>>> headings and file names, but I think only one or two people are apt
>>> to use these reports and they can surely learn to live with the
>>> shortcomings. Hopefullly, that's going to prove to be doable over
>>> the next couple of days.
>>>
>>> Dan
>>
>> I do that kind of export in FPW. However if I need to make a "more
>> Excelly"
>> presentation then I make what I call a cover sheet - ie a sheet in
>> Excel with all the pretty headings and formatting with a load of
>> links to the plain data tables I export from Fox. The data tables
>> get created in a "data"
>> subdirectory and the user just opens the cover sheet and updates
>> links.
>>
>> --
>> HTH
>> Andrew Howell



Re: FPD report help by Dan_Musicant

Dan_Musicant
Tue Feb 08 16:32:11 CST 2005

On Tue, 08 Feb 2005 14:54:44 +0100, Bernhard Sander
<fuchs@individsoft.de> wrote:

:Hi Dan_Musicant
:
:> Hm, I now realize that FPD won't care to have a filename longer than 8
:> characters. Oh, well.
:But you can
:RUN XCOPY 8char.xls "very long File Name also with Spaces.xls"
:or
:RUN RENAME 8char.xls "very long File Name also with Spaces.xls"
:right after your creation of the xls file. Don't forget the quotes if there are
:special characters in the long file name.
:This works in FPD which runs on a Windows with long filename support.
:
:Regards
:Bernhard Sander

Well, I tried this but couldn't get it to work. Maybe the problem is
that I won't know the filename until the file is about to be created. I
tried adding quotation marks to the name like this:

RENAME (lcFileName+'.xls') TO ('"'+xlsname+'"')

but I got an error: File doesn't exist. Don't know what to make of that.

Without the '"' fore and aft, it does rename the file, but it's only the
first 8 characters of it. Running Windows 2000.

Thanks for the help.


Re: FPD report help by Dan_Musicant

Dan_Musicant
Tue Feb 08 16:39:01 CST 2005

On Mon, 07 Feb 2005 16:53:32 GMT, Dan_Musicant <man@privacy.net> wrote:

:On 6 Feb 2005 11:40:03 -0600, Mike McBride <mcmike@netcene.com> wrote:
:
::Hi Dan,
::Are the requirements for your client's Excel request be that it be a
::FPD based solution? Where I work, our main company wide applications
::are all FPD based but we do our reporting and data extraction with
::VFP8 and soon VFP9. With VFP you have the option of automating the
::process entirely by opening Excel as an automation object and
::controlling it via Foxpro. This gives you the best of both worlds,
::your client gets to keep their legacy FPD app at the same time they
::get the benefits of what can be done with VFP.
::
::If this sounds like something you want to follow I recommend
::"Microsoft Office Automation with Visual FoxPro" from Hentzenwerk. It
::will get you a good explanation of how Office and FoxPro can work
::together.
::mike...
::
::http://www.hentzenwerke.com/catalog/autofox.htm
::
:
:Thanks, Mike. The guy who developed this FPD application over 10-12
:years did do some things in VFP. He too wasn't employed by the company,
:per se. He left and I was brought on (he showed me the ropes for a
:couple of days) and I've been asked to keep the ship afloat, so to
:speak. Occasionally, they ask me for enhancements, and this would fall
:in that category.
:
:It did occur to me that I could try to do this with Foxfire! or VFP. I
:think it's a question of what would be most cost-effective, what would
:save them the most money. I have to look at it from that perspective
:right now. So, I figure I'll just try to adapt the printing routines to
:export to Excel. That is, copy the printing procedures and turn them
:into Excel export procedures, figuring that will take the least time. It
:may not be spiffy in terms of headings and file names, but I think only
:one or two people are apt to use these reports and they can surely learn
:to live with the shortcomings. Hopefullly, that's going to prove to be
:doable over the next couple of days.
:
:Dan

I did manage to work up Excel export of the data as I described in
fairly short order. I even added just about all of the descriptive
information with some creative techniques:

I added an extra field to the cursor I did the export from, a field
whose length was the length of the largest string that was going to get
copied to it. I append 3 or so records to the bottom of the cursor and
fill the fields with totals, descriptive information and then do my COPY
TO (filename) TYPE XLS. The filename is only 8 characters, but they are
well chosen, and I'm told they will have no complaints as long as the
data is there. It's really quite OK and all they were looking for.

Thanks for the brainstorming and information!!

Dan

Re: FPD report help by Fred

Fred
Wed Feb 09 01:09:09 CST 2005

See? I told you I never tried it in FPD! ;)

--
Fred
Microsoft Visual FoxPro MVP


"Dan Freeman" <spam@microsoft.com> wrote in message
news:ezBwEigDFHA.3256@tk2msftngp13.phx.gbl...
> DDE is Windows-only.
>
> Dan
>
> Fred Taylor wrote:
>> Maybe you can use DDE? I've never tried that from FPD.
>>
>>
>> "Andrew Howell" <ajh@work> wrote in message
>> news:ep95hibDFHA.1296@TK2MSFTNGP10.phx.gbl...
>>> Dan_Musicant wrote:
>>>> It did occur to me that I could try to do this with Foxfire! or
>>>> VFP. I think it's a question of what would be most cost-effective,
>>>> what would save them the most money. I have to look at it from that
>>>> perspective right now. So, I figure I'll just try to adapt the
>>>> printing routines to export to Excel. That is, copy the printing
>>>> procedures and turn them into Excel export procedures, figuring
>>>> that will take the least time. It may not be spiffy in terms of
>>>> headings and file names, but I think only one or two people are apt
>>>> to use these reports and they can surely learn to live with the
>>>> shortcomings. Hopefullly, that's going to prove to be doable over
>>>> the next couple of days.
>>>>
>>>> Dan
>>>
>>> I do that kind of export in FPW. However if I need to make a "more
>>> Excelly"
>>> presentation then I make what I call a cover sheet - ie a sheet in
>>> Excel with all the pretty headings and formatting with a load of
>>> links to the plain data tables I export from Fox. The data tables
>>> get created in a "data"
>>> subdirectory and the user just opens the cover sheet and updates
>>> links.
>>>
>>> --
>>> HTH
>>> Andrew Howell
>
>



Re: FPD report help by Bernhard

Bernhard
Wed Feb 09 05:30:07 CST 2005

Hi Dan_Musicant


> Well, I tried this but couldn't get it to work. Maybe the problem is
> that I won't know the filename until the file is about to be created. I
> tried adding quotation marks to the name like this:
>
> RENAME (lcFileName+'.xls') TO ('"'+xlsname+'"')
Do not use the fox internal RENAME command, instead run the windows commands.

If the file names are stored in variables then you have to use macro expansion:

lcSource = lcFilename + ".xls"
lcDest = '"' + xlsname + '"'
RUN XCOPY &lcSource &lcDest
or
RUN RENAME &lcSource &lcDest

Regards
Bernhard Sander

Re: FPD report help by Dan_Musicant

Dan_Musicant
Fri Feb 11 19:16:32 CST 2005

On Wed, 09 Feb 2005 12:30:07 +0100, Bernhard Sander
<fuchs@individsoft.de> wrote:

:Hi Dan_Musicant
:
:
:> Well, I tried this but couldn't get it to work. Maybe the problem is
:> that I won't know the filename until the file is about to be created. I
:> tried adding quotation marks to the name like this:
:>
:> RENAME (lcFileName+'.xls') TO ('"'+xlsname+'"')
:Do not use the fox internal RENAME command, instead run the windows commands.
:
:If the file names are stored in variables then you have to use macro expansion:
:
:lcSource = lcFilename + ".xls"
:lcDest = '"' + xlsname + '"'
:RUN XCOPY &lcSource &lcDest
:or
:RUN RENAME &lcSource &lcDest
:
:Regards
:Bernhard Sander

Oh, I missed that (forgot it, actually) in your earlier post. My
mistake. Thanks so much for this clarification!!