Microsoft
Software
Hardware
Network
Question : Silverlight: open excel in Browser
Hi,
On my Silverlight project I need to show an excel document, received from the server, in a new browser tab.
With ASP works like this:
private void OpenReport(string name)
{
FileStream fs = File.OpenRead(name);
Response.AppendHeader("Con
tent-dispo
sition", "inline; filename=" + name);
Response.AppendHeader("Pra
gma", "no-cache");
Response.Expires = -1;
Response.ContentType = "application/vnd.ms-excel"
;
Response.BinaryWrite(GetWh
oleFileCon
tent(fs, (int)fs.Length));
Response.Flush();
}
private byte[] GetWholeFileContent(FileSt
ream f, int lenght)
{
byte[] stream = new byte[lenght+1];
f.Read(stream, 0, lenght);
return stream;
}
How to implement it on a Silverlight project?
Answer : Silverlight: open excel in Browser
try with the following inside your silverlight code:
System.Windows.Browser.Htm
lPage.Wind
ow.Navigat
e(new Uri(
http://servername/test
.xls
), ),"_blank");
Random Solutions
Data Grid Control in MFC
Populate listbox with Outlook MAPI folder messages
Error: (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe
The "Set Value' Macro action cannot be run in disable mode. in MS Access 2007
iphlpapi on windows 2000
PureEdge forms signed by ApproveIt software
Outlook 2007 keeps asking credentials for exchange
What workarounds are available to paste an image into a sharepoint list form
Locked out of SBS 2008
Outlook autodiscover popup issue - SBS 2008/Exchange 2007