Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to re-factor
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01135774
Message ID:
01135784
Views:
21
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>I have a custom function (thanks to Cetin & Borislav) that produces an Excel from DBF and applies some additional formatting. This function is called from several modules and it uses an array of field names.
>
>Now I have a need to add a certain color to some cells. For instance, we're sending the Excel file to third party and we want it to receive it with certain fields filled in. I want to add empty columns myself and I want them in the different color, so the third party would know, where new fields start.
>
>There could be several approaches:
>
>1. Leave the original function in tact, create a new function to apply additional formatting and call both functions.
>
>2. Have some optional parameters in the original function.
>
>I think, the second approach is better. I'm thinking, what kind of parameters would I need to add to the routine to make this generic enough?
>
>What do you think?
>
>Thanks in advance.

I prefer to use the same function, just add some additional parameters.
To make it to work without needs to rewrite other modules where this procedure is called you could add two parameters:
one Logical (which by default is .f.) and one which will shows you colums you need for different formating and what format, i.e.

If Function/Method till now is:
FUNCTION MyExcelFormat(par1, par2,..,parN)
you could change it to:
FUNCTION MyExcelFormat(par1, par2,..,parN,parN+1,parN+2 )
*** Old function body goes here
        IF parN+1 && Logical Parameter, from all other moduls this will be .f.
           *** put formating logixc here
        ENDIF
I can't remeber now that function
BUT I remeber that you found something in Excel that suppress Excel to use Regional settings of the computer.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform