What version of VFP are you using? 
If you set the VFP data type to VARCHAR instead of CHAR how does that affect 
the behavior of DataToClip (one of my favorite functions for quick and dirty 
stuff)?

I think you've probably got the best solution. Alternatively you could use 
TEXTMERGE inside a SCAN..ENDSCAN of your result cursor and build the file 
yourself instead of using DTC.

--

rk
-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of Ted Roche
Sent: Monday, July 13, 2015 10:18 AM
To: [email protected]
Subject: RTRIM() of cursor data using _VFP.DataToClip() ?

Imagine that, an ON-TOPIC post from me!

I'm working up a report for a client that does a SQL SELECT into a cursor to 
aggregate totals, format, filter, and sort data, and the result gets pasted 
into a pre-formatted spreadsheet, using:

_VFP.DataToClip(SELECT(), RECCOUNT(), 3)

to paste a tab-delimited columnar block into the Windows clipboard.

(I'm using LibreOffice Calc, not sure if that makes a difference).

VFP's SQL preprocessor is creating the result cursor column sizes based on the 
source data, so a C(30) source datatable column gets 30 characters, 
right-padded with spaces.

Since this is an output document and the client wants it to look as pretty as 
posslble, they're optimizing column widths, and the right-padding is leaving 
the columns bloated. Centered-text columns come out even worse.

Right now, I'm post-processing the data in the spreadsheet with a Regular 
Expression Replace of "[ \t]+$" with empty space, but was wondering if anyone 
knew a trick to get this trimming to occur in Fox?

One thing I tried was changing the field argument in the select from 
sourcetable.fieldname to PADR(RTRIM(sourcetable.fieldname),20,CHR(0))
to zero-fill the strings. It worked for the cursor, but the fields still show 
as filled in the spreadsheet.

Any ideas?

--
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/bn4pr10mb0913a4dc2cc23c892bfdf1fcd2...@bn4pr10mb0913.namprd10.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to