Question Problem Opening Spreadsheet in EXCEL

kirsch59

Member
I'm running webspeed 10.1c on a Window's 2003 server. I'm running IE 9 and Microsoft Office EXCEL 2010 on a Windows 7 pc. After many years of downing data into EXCEL I started getting the following error message from EXCEL:
excel-error.jpg

Here's some snippet of code:

filename = "GLCodeSpreadsheet.xls".'

output-http-header("Content-disposition","Attachment~; filename=" + filename).
RUN OutputContentType IN web-utilities-hdl("application/vnd.ms-excel").
{&OUT}
"<TABLE>"
"<TR><TD>"Financial Spreadsheet </TD></TR>"
"<TR><TD>"GL Code By Ship-to</TD></TR></TABLE>"
.

Does EXCEL 2010 expect a different content type?

Any help is appreciated.
 

Cringer

ProgressTalk.com Moderator
Staff member
What happens when you try and open the file manually in Excel?
 

lee.bourne

Member
You're stating a content type of Excel but then outputting an HTML table. Perhaps alter your code to output a CSV file instead as Excel can open both .xls and .csv. Use a content type of text/csv, a filename of GLCodeSpreadsheet.csv and then output text such as:

{&OUT}
"cella1,cellb1" skip
"cella2,cellb2" skip
.

Lee
 

kirsch59

Member
When I do a "save as" the file it's saved as an Excel 97-2003 worksheet.
When I open the file using EXCEL 2010 I get the same error message.
 

kirsch59

Member
When I changed the context type to text/csv
(RUN OutputContentType IN web-utilities-hdl ("text/csv":U).

EXCEL 2010 open as a csv; however, the HTML table displayed as HTML tags and not a table.
 

kirsch59

Member
The HTML tags allows me to format the spreadsheet, add color, fonts, etc. I would like to keep the HTML tags on the webspeed side.
 

lee.bourne

Member
This is a wild guess but maybe for Excel 2007+ you should be using .xlsx and application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Presumably you may also have to add a little extra at the top and bottom of the html to make it valid xhtml but I can't help any further on that. A little googling suggests that might be the case though.

Good luck,

Lee
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
I'm running webspeed 10.1c on a Window's 2003 server. I'm running IE 9 and Microsoft Office EXCEL 2010 on a Windows 7 pc. After many years of downing data into EXCEL I started getting the following error message from EXCEL

You started getting this error. So what did you change just prior?
 

kirsch59

Member
The changes were on the client side. Updated the OS to Windows 7 and Office 2010 and IE 9. My guess it's something with EXCEL 2010.
 

Stefan

Well-Known Member
According to this post, this security feature was introduced in Excel 2007

Upgrading to Excel XML Spreadsheet (introduced in Office XP) is pretty painless:

Code:
{ src/web/method/wrap-cgi.i }

output-http-header( "Content-Disposition", "Attachment; filename=hello.xml" ).

RUN OutputContentType IN web-utilities-hdl ( "application/vnd.ms-excel" ).

{&OUT}
   '<?xml version="1.0"?>'
   '<?mso-application progid="Excel.Sheet"?>'
   '<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">'
      '<Worksheet ss:Name="ProgressTalk">'
         '<Table>'
            '<Row>'
               '<Cell>'
                  '<Data ss:Type="String">Financial Spreadsheet</Data>'
               '</Cell>'
            '</Row>'
            '<Row>'
               '<Cell>'
                  '<Data ss:Type="String">GL Code By Ship-to</Data>'
               '</Cell>'
            '</Row>'
         '</Table>'
      '</Worksheet>'
   '</Workbook>'
   .

The big advantage of using this older format over xlsx is that you do not need to worry about creating zip files.
 

kirsch59

Member
I'm getting the error message because I'm passing HTML tags to EXCEL 2010. I'm returning HTML with a MIME type of EXCEL.

Thanks for everyones help.
 
Top