Ted Roche wrote on 2015-07-13: > 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, I was thinking you could... You might be able to use the Reduce() function in the FoxTools.FLL. It will reduce double space to a single space. You would manipulate the _ClipText variable. After dumping _ClipText to a file with StrToFile() it looks like the output created by DataToClip() is Space Delimited. Does it paste in to separate columns? Pasting in to Excel 2010 drops everything in to column I pasted. Then I need to separate the text. It appears you need to Comma Delimit the text. HTH, Tracy Tracy Pearson PowerChurch Software _______________________________________________ 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/[email protected] ** 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.

