We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Save RDL report to physical folder

Thread ID:

Created:

Updated:

Platform:

Replies:

142641 Feb 12,2019 05:20 AM UTC Feb 14,2019 02:50 PM UTC ASP.NET Web Forms 7
loading
Tags: ReportDesigner
MEGHA
Asked On February 12, 2019 05:20 AM UTC

In Report designer how do we save RDL file to Physical folder?
As of now it is getting downloaded. I want RDL report to save in some particular folder on Save Click.

Mageshyadav M [Syncfusion]
Replied On February 13, 2019 06:28 AM UTC

Hi Megha,  
  
We can able to save or open the report using External server in web Report Designer. We have prepared the simple sample in ASP.NET WebForms application and it can be downloaded from below location.  
  
Note: In above sample we have used the External server for open/edit/save the existing report using External server.  
  
We are getting the existing reports, datasources and datasets available in our shared application as shown in below code example. If you want to use any other location then we can modify the path accordingly.   
   
ExternalServer.cs:   
   
public override List<CatalogItem> GetItems(string folderName, ItemTypeEnum type)   
        {   
            List<CatalogItem> _items = new List<CatalogItem>();   
            string targetFolder = HttpContext.Current.Server.MapPath("~/") +@"App_Data\ReportServer\";   
   
            if (type == ItemTypeEnum.Folder || type == ItemTypeEnum.Report)   
            {   
                targetFolder = targetFolder + @"Report\";   
                if (!(string.IsNullOrEmpty(folderName) || folderName.Trim() == "/"))   
                {   
                    targetFolder = targetFolder + folderName;   
                }   
            }   
   
            if (type == ItemTypeEnum.DataSet)   
            {   
                foreach (var file in Directory.GetFiles(targetFolder + "DataSet"))   
                {   
                    CatalogItem catalogItem = new CatalogItem();   
                    catalogItem.Name = Path.GetFileNameWithoutExtension(file);   
                    catalogItem.Type = ItemTypeEnum.DataSet;   
                    catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+""_");   
                    _items.Add(catalogItem);   
                }   
            }   
            else if (type == ItemTypeEnum.DataSource)   
            {   
                foreach (var file in Directory.GetFiles(targetFolder + "DataSource"))   
                {   
                    CatalogItem catalogItem = new CatalogItem();   
                    catalogItem.Name = Path.GetFileNameWithoutExtension(file);   
                    catalogItem.Type = ItemTypeEnum.DataSource;   
                    catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+""_");   
                    _items.Add(catalogItem);   
                }   
            }   
            else if (type == ItemTypeEnum.Folder)   
            {   
                foreach (var file in Directory.GetDirectories(targetFolder))   
                {   
                    CatalogItem catalogItem = new CatalogItem();   
                    catalogItem.Name = Path.GetFileNameWithoutExtension(file);   
                    catalogItem.Type = ItemTypeEnum.Folder;   
                    catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+""_");   
                    _items.Add(catalogItem);   
                }   
            }   
            else if (type == ItemTypeEnum.Report)   
            {   
                foreach (var file in Directory.GetFiles(targetFolder, "*.rdl"))   
                {   
                    CatalogItem catalogItem = new CatalogItem();   
                    catalogItem.Name = Path.GetFileNameWithoutExtension(file);   
                    catalogItem.Type = ItemTypeEnum.Report;   
                    catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+""_");   
                    _items.Add(catalogItem);   
                }   
            }   
   
            return _items;   
        }   
  
If the above suggestion doesn’t meets your requirement please let us know additional details on your requirement to assist further.  
  
Regards,  
Mageshyadav.M 


Padmini Ramamurthy [Syncfusion]
Replied On February 13, 2019 07:31 AM UTC

From: Megha T P 
Sent: Wednesday, February 13, 2019 1:35 AM
To: Syncfusion Support <support@syncfusion.com>
Subject: Re: Syncfusion support community forum 142641, Save RDL report to physical folder , has been updated. 

Hi , 

Thank you so much for the solution. 
I will look onto the same and get back to you. 

Regards, 
Megha 


Mageshyadav M [Syncfusion]
Replied On February 13, 2019 09:13 AM UTC

Hi Megha, 
  
Thanks for your update. Please let us know if you have any further doubts on validating the solution provided. 
  
Regards, 
Mageshyadav.M 


MEGHA
Replied On February 13, 2019 10:32 AM UTC

Hi MageshYadav,


Thank You so much for the solution.
Its working as per my reqirement with some changes.
I am able to save the file in physical path and from there reading RDL content and updating it to DB.


Regards,
Megha



Mageshyadav M [Syncfusion]
Replied On February 13, 2019 11:28 AM UTC

Hi Megha, 
  
Thanks for your update. 
  
We are glad to hear that you were able to achieve your requirement using provided solution. 
  
Regards, 
Mageshyadav.M 


MEGHA
Replied On February 13, 2019 12:52 PM UTC

Hi MageshYadav,

Like the same way is there any override option to achieve the same in Report viewer ?

<ej:ReportViewer runat="server" ID="viewer"  ReportServiceUrl="/api/ReportDesigner">
</ej:ReportViewer>

Here we need to set report path to render report viewer right.
But same i dont want to read from physical file.
I need to pass teh rdl content and render the report.

As of now doing like this.

   string reportDefID = "E4457F87-9803-4089-AA18-713F26E5A8CA";// We can get from request query string.
   string targetFolder = HttpContext.Current.Server.MapPath("~/") + @"App_Data\Report\";
  string reportPat = targetFolder + @"\" + reportDefID + ".rdl";
   viewer.ReportPath = reportPat;

Instead of setting report path is there any way we can open from filestream.

From DB reading XML and making it as filestream.
Client not allowing me to use physical path concept here so .
As given by your older example I am able to save RDL in DB and able to open designer From XML content stored in DB without physical path.

Could you please help me on this Report viewer functionality.



Regards,
Megha



Mageshyadav M [Syncfusion]
Replied On February 14, 2019 02:50 PM UTC

Hi Megha, 
 
Yes, we can achieve your requirement of passing as FileStream to ReportViewer instead of ReportPath. Please find the snippet handled in controller side below, 
 
    public class ReportApiController : ApiController, IReportController 
    { 
        public object PostReportAction(Dictionary<string, object> jsonResult) 
        { 
            return ReportHelper.ProcessReport(jsonResult, this); 
        } 
 
        [System.Web.Http.ActionName("GetResource")] 
        [AcceptVerbs("GET")] 
        public object GetResource(string key, string resourcetype, bool isPrint) 
        { 
            return ReportHelper.GetResource(key, resourcetype, isPrint); 
        } 
 
        public void OnInitReportOptions(ReportViewerOptions reportOption) 
        { 
            FileStream fs = new FileStream(HttpContext.Current.Server.MapPath("~/App_Data/GroupingAgg.rdl"), FileMode.Open, FileAccess.Read); 
            reportOption.ReportModel.Stream = fs; 
        } 
 
        public void OnReportLoaded(ReportViewerOptions reportOption) 
        { 
             
        } 
    } 
 
Please find the sample reference below which will assist your requirement, 
 
 
Note: In the above sample, we have read the physical path file as stream and loaded it. You can modify the sample as per your needs to pass the xml content as FileStream. 
 
Regards, 
Mageshyadav.M 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;