Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a shortcut pointing to an xls file. In my C# application, I need to launch the shortcut with Excel.

 

I am currently doing this:

 

string full_path = path;

FileInfo file = new System.IO.FileInfo(full_path);

 

try

{

if (file.Exists)

{

Response.Clear();

Response.AddHeader("Content-Disposition",

"attachment; filename=" + file.Name);

Response.AddHeader("Content-Length", file.Length.ToString());

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

Response.Flush();

Response.WriteFile(file.FullName);

Response.End();

}

}

 

This fails because the shortcut fails on the file.Exists function. How should I launch the shortcut with Excel?

 

TIA.

Posted
Are you returning an excel spreadsheet from a web application or trying to do something else?

 

Upon clicking a button, I would like to launch a shortcut file that is pointing to an Excel xls sheet.

  • Administrators
Posted
Does the excel file reside on the client or the server? If it is on the server then you will not be able to launch it on the client in this manner. If the file exists on the client I would check that the full_path variable does indeed contain the correct path.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...