I'm building a reporting application that produces reports in both Excel and Crystal report formats. In some cases I want to create a report directly in Excel using the Syncfusion XLSIO tool and sometimes I want to return a Crystal ReportDocument object
to display in the Crystal viewer. In both cases I could write the output to a file and then return base-64 encoded representation of that as a string but I'd like to handle this completely in memory without disk I/O.
Does anyone have any sample code showing how to return a complex object from a Web Api method to a browser?
CarlGanz
Member
1 Points
1 Post
Return Excel from Web Api
Dec 20, 2012 01:45 PM|LINK
I'm building a reporting application that produces reports in both Excel and Crystal report formats. In some cases I want to create a report directly in Excel using the Syncfusion XLSIO tool and sometimes I want to return a Crystal ReportDocument object to display in the Crystal viewer. In both cases I could write the output to a file and then return base-64 encoded representation of that as a string but I'd like to handle this completely in memory without disk I/O.
Does anyone have any sample code showing how to return a complex object from a Web Api method to a browser?
Thanks
Carl
urenjoy
Star
12171 Points
1824 Posts
Re: Return Excel from Web Api
Dec 22, 2012 09:59 AM|LINK
You can return stream as HttpResponseMessage from a Web Api method, check following:
http://stackoverflow.com/questions/9541351/returning-binary-file-from-controller-in-asp-net-web-api
Fast Downloading with Parallel Requests using ASP.NET Web API