AppendXLSX/WorkbookXLSX

Update 11/27/17: I’ve found the WorkBookXLSX library from VFPX to be more stable than AppendXLSX and use that now rather than AppendXLSX. I have found two little gotchas with WorkbookXLS:

  • The table  you’re exporting should not be open
  • The code seems to turn Deleted Off. If you want it on, you should re-set that command after running this.

Old post about the no longer used AppendXLSX:

I’ve been using the AppendXLSX tool to create XLSX files from my Foxpro data. It works great for the most part, but occasionally I find that it builds the XLSX file but it will be a corrupt file with no data in it. After a lot of fiddling, I figure out that more than 1 date field in the file seems to cause the problem.

This quick bit of code will change the data fields in your table into character.

FOR x = 1 TO FCOUNT()
IF TYPE(FIELD(x)) = “D”
ALTER table (ALIAS()) Alter COLUMN (FIELD(x)) C(10)
ENDIF
NEXT

 

(Does anyone know where AppendXLSX comes from? There’s nothing in the comments saying who the author is and may googling didn’t turn up anything. Whoever your are author, thanks a ton for this tool.)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s