Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5.1 > ASP.NET 4.5.1 General Discussion
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:45 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.