Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-18-2017, 02:26 AM
PhillJ PhillJ is offline Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match. Windows 8 Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match. Office 2013
Novice
Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match.
 
Join Date: Aug 2017
Posts: 3
PhillJ is on a distinguished road
Default Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match.

Our financial application shows data grids (Oracle Forms), which users can EXPORT. This creates an Excel spreadsheet on the server which is then opened automatically by the browser. This allows the users to have their own spreadsheet copy of what they were viewing in the application.
The spreadsheet is generated in SYLK format, for example:

Content-type: application/vnd.ms-excel

ID;ORACLE
P;FVerdana;M200
P;FVerdana;M200;SB
P;FVerdana;M200;SUB
F;C1;FG0R;SM1
F;C2;FG0G;SM0
F;C3;FF0G;SM0
F;C4;FF0G;SM0
F;C5;FF2G;SM0
F;C6;FG0G;SM0


F;C7;FG0G;SM0
F;C8;FF2G;SM0
F;C9;FF2G;SM0
F;C10;FG0G;SM0
F;C11;FG0G;SM0
F;C12;FG0G;SM0
F;R1;FG0C;SM2
C;Y1;X1;K"eFin"
C;X2;K"Module"
C;X3;K"Usage"
- etc.

This is long-standing source code that has been working satisfactorily for years. Note the leading "Content-type:" setting.

However, some clients are getting messages which they do not like:


This appears to be a mismatch between the file contents, in SYLK format, and the file extension .xls. Note that the filename 'cfxsof.xls' appears to be generated by some layer within the browsing 'stack'; there is a CGI program called cfxsof.exe which 'provides' the generated file to the browser.

How can we ensure a match between the file contents and file extension?
Is there an alternative to the Content-Type setting?
Is there a way of defining a filename to overrule the generated "cfxsof.xls"?

Thank you in advance.
Reply With Quote
  #2  
Old 08-18-2017, 02:38 PM
macropod's Avatar
macropod macropod is offline Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match. Windows 7 64bit Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

To put it simply, SLK files are not Excel files (notwithstanding that Excel can open them) and should have an SLK extension, not an XLS extension. So, if you want "a match between the file contents and file extension", you should change the extensions to SLK.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 08-22-2017, 01:35 AM
PhillJ PhillJ is offline Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match. Windows 8 Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match. Office 2013
Novice
Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match.
 
Join Date: Aug 2017
Posts: 3
PhillJ is on a distinguished road
Default

Thank you for your reply. However, I do NOT name the file, and this really is what I need help with. The file is opened via a browser URL such as follows:
/dev50-cgi/cfxsof?4F66505C2F6B574F713225584D513E585B4F4F506E4 97E79704C55214E38515657564B7B77543C5A723D3E2658686 72B265A7932

... where cfxsof.exe is a CGI program which takes a single encrypted string referring to a file to display in the browser (either an Adobe PDF or an Excel). cfxsof then writes the contents of this file to the output stream and hence this is handled by the browser. The first line of this file has the following:
Content-type: application/vnd.ms-excel

However, the browser creates a temporary filename in its cache typically named cfxsof.xls, or cfxsof, as in the message:


My question is now: how do I influence the name of the temporary file so that it is compatible with the contents that Excel discovers? It seems to me that it is this temporary file name created by the browser which is the crux of the problem.
Thanks in advance.
Reply With Quote
  #4  
Old 08-22-2017, 02:49 AM
macropod's Avatar
macropod macropod is offline Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match. Windows 7 64bit Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Whatever the images you're posting are, they don't display on this forum and, hence, I can't see what they're supposed to display. Thus I have no idea what the messages in posts 1 & 3 are.

A file with a line like:
Content-type: application/vnd.ms-excel
simply tells a web browser to treat the content as an Excel file. For Excel 2007 & later xlsx files, so too does:
Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

That said, unless the file is being named by Excel, I doubt there's anything that can be done about that from the Office side of things; it's entirely under to control of the software that's creating the files.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 08-22-2017, 03:10 AM
PhillJ PhillJ is offline Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match. Windows 8 Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match. Office 2013
Novice
Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match.
 
Join Date: Aug 2017
Posts: 3
PhillJ is on a distinguished road
Default Think I have fixed this for myself

Thanks for your reply.

The first response highlighted the filename - upon further research, I see that the MIME type header can be enhanced with...
Content-Disposition: attachment; filename=<name>.slk;
... and this now works without giving annoying messages. (The browser layer is < 1% of our code base and we don't know the technology.) The key part is the filename extension of SLK: the MIME header provides a filename rather than the browser creating a name on the fly. This gives the control over filename/contents that we require.

Apologies for the missing images, but I assumed that since they paste in successfully then they are accepted for later display.
Reply With Quote
Reply

Tags
browser, sylk

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to find and format with whole word match option Marrick13 Excel Programming 0 03-13-2016 10:04 AM
Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match. HOW TO: Create an auto generated number format for saving templates Matkinson89 Word 2 09-03-2015 07:07 PM
Generated spreadsheet in SLK format causes message upon browsing: format / extentsion don't match. Mail merge will not format date field generated by Excel IF statement borntorun75 Mail Merge 3 12-16-2011 06:28 AM
Outlook Message Format Default hobo222 Outlook 2 11-23-2010 08:25 PM
How to set Message Format default TonyBender Outlook 0 10-27-2009 11:52 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:02 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft