Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speeding up writing a word document
Message
From
18/07/1999 14:13:06
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
To
17/07/1999 12:42:54
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00242250
Message ID:
00242885
Views:
18
>
Application.DataToClip(alias(),reccount(),3)
>_cliptext = strtran(_cliptext,chr(9)+chr(13),chr(13))
>_cliptext = strtran(_cliptext,chr(13)+chr(13),chr(13))
>do while occurs(" "+chr(9),_cliptext)>0
> _cliptext = strtran(_cliptext," "+chr(9),chr(9))
>enddo
I've done this for Excel - and discovered that _vfp.datatoclip has its limitations. Not only the padding spaces, but some other things which formatted the data in a way I didn't like, so I wrote something likethis:
#define cTab chr(9)
#define cr chr(13)
scan
   _outtext=_outtext+Trim(field1)+cTab
   _outtext=_outtext+ctod(datefield)+ctab
   _outtext=_outtext+mline(memofield,1)+ctab
   _outtext=_outtext+alltr(str(nField,11,2))+cr
ends
_cliptext=_outtext
[ paste into excel now]
It works like a charm - all the formatting is done in VFP, and I was actually shocked to understand that VFP has stronger string functions than Word 97 (or Excel, for that matter). I mean, Word should be a text processing oriented tool.

BTW, one thing doesn't work in Excel - I'm writing one column which contains a string, which is used as an index into a lookup table on Sheet2. If this string begins with an alpha char, it works fine; if it contains digits only, the lookup formula returns #N/A. Formatting whole column as text doesn't help. Sometimes pasting the same number from another cell with the same value helps, sometimes it doesn't. Don't have a clue why does it do this.

I've heard there should be some chr(?) to prefix such fields, to have Excel accept them as text containing digits, and not as a number, but wouldn't know which one.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform