Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8015873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:22:47+00:00 2026-06-04T20:22:47+00:00

Short version: I have a third-party MVC Extension that returns the FileResult. I would

  • 0

Short version:
I have a third-party MVC Extension that returns the FileResult. I would like to be able to process the file before returning it to the client. How can I do that?

If you’re interested in boring details, read below:

I’m using Devexpress XtraReports for reporting purposes. The problem is that it’s PDF Export is terrible, but RTF one works great. I would like to create action&result filter that would trick DevExpress into generating rtf instead of pdf (done) and convert the rtf to pdf using some other third-party library. The only problem is that I need to obtain rtf file from FileResult and return my own FileResult with the converted content.

//EDIT:
The code right now looks as follows:

        public virtual ActionResult ReportExport(TParameters parameters)
        {
            return DevExpress.Web.Mvc.ReportViewerExtension.ExportTo(this.GetReport(parameters));    
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:22:49+00:00Added an answer on June 4, 2026 at 8:22 pm

    You said you are using a third-party MVC extension that returns a FileResult and you want to access the file details that are wrapped inside the result.

    If you see the FileResult, it is an abstract class and I just know there are three built-in implementations are available in MVC (I don’t aware about others): FileContentResult, FileStreamResult and FilePathResult.

    All these classes provide public properties to access the details of the file. For ex. the FileContentResult contains a public property called FileContents that returns the content of a file as a byte array.

    The third-party extension can return any FileResult implementation of the built-in types or badly(if you can’t access those type) their own types as well. You can check the returned FileResult instance’s type and cast it accordingly to access the file details.

    var fileResult = ... returned by the MVC extension
    
    if(fileResult is FileContentResult)
    {
       var fileContentResult = fileResult as FileContentResult;   
       var fileContent = fileContentResult.FileContents;
       // process the file
    }
    else if(fileResult is FileStreamResult)
    {
       var fileStreamResult = fileResult as FileStreamResult;
       var fileStream = fileStreamResult .Stream;
       //...
    }
    else if(fileResult is FilePathResult) // this result only contains the path 
                                          // of the file name
    {
      //...
    }
    

    If you want make the things reusable you can implement a custom file result that takes the FileResult returned by the extension in the constructor and override the WriteFile method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a short version of the question: I start a thread like that:
Short version: I have an MSBuild project that imports another project. There is a
I have a project that uses a third party library in the form of
Short Version I have a list of int s that I need to figure
The short version is that I have a protocol which has an optional parameter.
So you have a third-party web service that likes to abuse XML and return
Short version I would like to scroll the ListBox item into view when the
Short version: Say I have a string str and a file functions.py from which
Here is the short version. I have a Bonus Activity that has 25 image
Short version: I have a similar setup to StackOverflow. Users get Achievements. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.