Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 4.5.1 General Discussion For ASP.NET 4.5.1 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4.5.1 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 1st, 2019, 03:43 PM
Friend of Wrox
Points: 2,876, Level: 22
Points: 2,876, Level: 22 Points: 2,876, Level: 22 Points: 2,876, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Denver, CO, USA.
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default Open Excel from web page

I have been told to "write some code" to open Excel from 4 different web sites and display their calling page contents. The process is currently using:

Response.ContentType = "application/vnd.ms-excel"

Which seems to accept the page's contents, but it is displaying this warning:

The file format and extension of 'filename.xls' don't match. The file could be corrupted or unsafe. Unless you trust its source, don't open it. Do you want to open it anyway?

Depending on how the user responds, they could see more warnings and dialog boxes, which is apparently further confusing users. My boss insists there's some way to avoid this warning without first saving the spreadsheet, but he has no idea how and I've been unable to find such a solution. This web site:

https://blogs.msdn.microsoft.com/vsofficedeveloper/2008/03/11/excel-2007-extension-warning-on-opening-excel-workbook-from-a-web-site-2/

Says the Alert is a new security feature of Excel, but offers no suggestions about how to avoid it? I've tried modifying the file extension before opening Excel, but when Excel opens, the file name is changed from 'filename.xlsx' to the name of the page opening Excel: 'pagename.aspx'. This is how the Excel file name is currently being passed from ASP:

Response.AddHeader("Content-Disposition", "filename=" & File_Name)

Is there some trick to successfully passing a file name to Excel that I've overlooked? Is there some other way to open Excel that will import the page contents and produce a matching spreadsheet? I know I can open the sites from Excel, but that's too complicated for our users. They just want to click a button.

CreateObject("Excel.Application")

appears to require coding to format the spreadsheet like the page, which will require a complete rewrite of all four applications, unless I've misunderstood something?

Or is this simply not possible?


Similar Threads
Thread Thread Starter Forum Replies Last Post
can’t open the page because the server where this page is located isn’t responding m_alsobaai Forum and Wrox.com Feedback 3 July 15th, 2010 06:13 AM
open excel document in jsp page mermaid VB How-To 1 December 3rd, 2004 06:45 PM
open excel file C# ? npqk VS.NET 2002/2003 2 November 26th, 2004 10:31 AM
How can i open Excel From VB6 chiefouko Beginning VB 6 1 June 30th, 2003 08:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.