troubleshooting Question

Silverlight: open excel in Browser

Avatar of fabcar
fabcar asked on
Web DevelopmentASPMicrosoft Development
1 Comment1 Solution1529 ViewsLast Modified:
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("Content-disposition", "inline; filename=" + name);
        Response.AppendHeader("Pragma", "no-cache");
        Response.Expires = -1;
        Response.ContentType = "application/vnd.ms-excel";
        Response.BinaryWrite(GetWholeFileContent(fs, (int)fs.Length));
        Response.Flush();
    }


    private byte[] GetWholeFileContent(FileStream f, int lenght)
    {
        byte[] stream = new byte[lenght+1];
        f.Read(stream, 0, lenght);
        return stream;
    }

How to implement it on a Silverlight project?
ASKER CERTIFIED SOLUTION
Jaime Olivares
Software Architect
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros