RE: Flat file to Excel....but it's got more than 255 columns!

Author: Kevin J Cully

Posted: 2016-08-18 at 11:58:37

Thinking outside of the box...

Don't use the Excel automation. Convert the flat file into an XML string, and spit that out into a file named "MyFile.xls" and then have Excel open that. It'll be wicked fast. Excel will load the XML as if it was an Excel spreadsheet.

I think Christof had a posting a couple of years ago with a VFP class that would allow for some formatting (Bolds, colors, etc.) of the XML so it looks "nicer" when opened. I think you can even put formulas in the XML and have Excel honor it.

I've used this in VFP and Xojo over the years. It's a great way to do "Excel" without having Excel installed and without worrying about M$ borking up the automation version to version.

-Kevin

-----Original Message-----

From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of mbsoftwaresolutions@mbsoftwaresolutions.com

Sent: Thursday, August 18, 2016 12:29 PM

To: profox@leafe.com

Subject: Flat file to Excel....but it's got more than 255 columns!

VFP9SP2/Win7Pro/SDF fixed width file

I've got a flat file that needs to be translated to an Excel file.

Traditional program put it into a cursor and then via automation did copy/paste into Excel. Problem is now that there are more than 255 columns (410 to be exact) so using a VFP cursor/table won't work. I was just doing direct string manipulations and insertting right to the Excel cells, but it's a SLOW process. It works, but I'm always looking for a better way.

Suggestions for approach?

tia!

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

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/F82DB4DE49440845A14B540F6C2DF6A91BEAF6@BLUFITSPMBS01.cherokeega.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.

©2016 Kevin J Cully