Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Exporting to Excel file
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01660147
Message ID:
01660174
Views:
37
>>>>>>>Hi,
>>>>>>>
>>>>>>>Whenever I export a file from VFP 9 application (either using EXPORT TO or Createobject("Excel.Application")) and then open the resulting Excel file, I get the message (as shown in the attached image). Then, when I click on Yes (that is to open it anyway), I don't seem to see any problems with the Excel file content?
>>>>>>>Why then MS Excel shows this message?
>>>>>>>TIA
>>>>>>
>>>>>>I believe you'll see this is you EXPORT with TYPE XLS. Similarly, make sure you're choosing an appropriate format when you save the file via Automation. There's a parameter for SaveAs that lets you specify the format you want. If you're creating an XLSX file, give it that extension.
>>>>>>
>>>>>>Tamar
>>>>>
>>>>>As far as EXPORT to, I changed the type to XL5 (as you suggested).
>>>>>
>>>>>And as far as saving as XLSX with SaveAs, would the customer who has an older version of Excel (e.g. 2003) have a problem opening the .XLSX file?
>>>>>
>>>>
>>>>Yes. So use an older version and just make sure you specify which one you want in SaveAs. I'd go with the latest version that isn't XLSX.
>>>>
>>>>Tamar
>>>
>>>Thank you. This is what I will do; leave as it is (EXPORT TO TYPE XL5)
>>
>>A few things to consider:
>>
>>1. The .xlsx file format was introduced with Office 2007 (which recently went out of MS support). IME all users still using Office 2003 have installed the Office Compatibility Pack, which allows it to work with .xlsx/.docx/.pptx etc. So even if you have users still on Office 2003 they should be able to consume .xlsx files. I don't know of anyone still using Office XP/2002 or earlier, they should not be.
>>
>>2. Since the beginning of this year (if not earlier), the older .xls/.doc file formats have been targeted by malware. Malformed documents of those types can compromise systems so increasingly, email systems will not allow those document types as attachments in received mail.
>>
>>3. Increasingly, Office itself is locking down those earlier document types: https://support.office.com/en-us/article/what-is-file-block-10d0e0ab-fecf-4605-befd-1e6563e7686d?ui=en-US&rs=en-US&ad=US
>>
>>4. I support an app that has an export to Excel function. A recent enhancement required Office automation. This worked well for most end users but consistently crashed for a few users on the latest platform: Excel 2016 on Windows 10. I spent *a lot* of time troubleshooting this and could not find a resolution. We had to abandon Excel automation.
>>
>>5. Office automation has never been suitable for heavy duty use. In this article https://support.microsoft.com/en-ca/help/257757/considerations-for-server-side-automation-of-office , Microsoft discusses why it's not suitable for heavy-duty use on a server. With caveats as explained in the article, it seems to say that light-duty client-side-only use is OK. Nonetheless this doesn't give me the warm fuzzies that automation was never architected for reliable, heavy-duty use.
>>
>>6. Greg Green has very kindly developed and released his "XLSX-Workbook-Class": https://github.com/ggreen86/XLXS-Workbook-Class . This class is extensive and allows working with .xlsx files without needing Excel installed, or using Office automation. We're now using this in its place. It has a lot of features but you can do things like save a cursor to a .xlsx with a single method call.
>>
>>So, although using SAVE AS ... XL5 to generate a .xls may work for your use case and customers, I wouldn't recommend it for lurkers. After the fairly recent painful support experience, I can't really recommend Office automation either.
>>
>>If you have a little time I'd suggest checking out Greg's class.
>
>Thank very much for all your input. I just downloaded the .zip file from github and will try to figure out how to use it.
>
>UPDATE. I just looked at the PDF documentation and it is 80 (!) pages. I wish there was a quick guide on how to use it.

UPDATE 2. I just used the included TABLETOEXCEL.PRG (that was part of the .zip) and it quickly converted a DBF table to an .xlsx format. So, maybe, I don't have to read 80 pages (which would take a long time). The table is very simple and I will test on a table that has a MEMO (which is why the Automation has to be used). And what you said, the idea of NOT needing Excel installed on the users' computer is very appealing!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform