Skip to content

Commit

Permalink
Merge pull request #12 from fediachov/master
Browse files Browse the repository at this point in the history
Update WebReport
  • Loading branch information
fediachov authored Oct 30, 2018
2 parents 2da01b5 + 8c10837 commit d8d58fc
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
1 change: 1 addition & 0 deletions COMPARISON.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ FastReport Core sources and nupkg files are included in FastReport .Net Profess

[FastReport .Net and FastReport Core home page](https://www.fast-report.com/en/product/fast-report-net/)

[FastReport Online Designer](https://www.fast-report.com/en/product/fast-report-online-designer/)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ We wish to draw up your attention to the fact that Documentation is under constr
[FastReport Open Source](https://github.com/FastReports/FastReport "Click for visiting the FastReport Open Source GitHub")

[FastReport .Net User's Manual](https://www.fast-report.com/public_download/html/UserManFrNET-en/index.html)

[FastReport Online Designer](https://www.fast-report.com/en/product/fast-report-online-designer/)
57 changes: 54 additions & 3 deletions WebReport.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

FastReport.OpenSource.Web supports latest versions of Chrome, Firefox, Safari, Opera and Edge browsers.

## Using **FastReport.OpenSource.Web** in ASP.NET MVC application
## Using WebReport in ASP.NET MVC application

1. Add **FastReport.OpenSource.Web** as nuget dependency in your **ASP.NET Core** project:

Expand All @@ -27,7 +27,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
}
```

3. Create **WebReport** object and render it in your view file:
3. Create WebReport object and render it in your view file:

```csharp
public IActionResult Index()
Expand All @@ -47,7 +47,58 @@ public IActionResult Index()
</div>
```

## FastReport.OpenSource.Web Examples
## Editing a Report in FastReport Online Designer

The WebReport can be used together [FastReport Online Designer](https://www.fast-report.com/en/product/fast-report-online-designer/).

Look at the following example:
```csharp
public IActionResult Index()
{
var webReport = new WebReport();
webReport.Report.Load(Server.MapPath("~/App_Data/report.frx"));
// Enable code editor in the Report Designer
webReport.Mode = WebReportMode.Design;
// Disable editing of script code
webReport.DesignScriptCode = false;
// Set a path to the Report Designer
webReport.DesignerPath = "/WebReportDesigner/index.html";
// Set a path to the Designer Save Callback
webReport.DesignerSaveCallBack = "~/Home/SaveDesignedReport";
// Set a ID for using it in Callback
webReport.ID = "DesignReport";
return View(webReport);
}

....

[HttpPost]
// Call-back for save the designed report
public ActionResult SaveDesignedReport(string reportID, string reportUUID)
{
ViewBag.Message = String.Format("Confirmed {0} {1}", reportID, reportUUID);
if (reportID == "DesignReport")
{
// Do something with designed report, for example
Stream reportForSave = Request.InputStream;
string pathToSave = Server.MapPath("~/App_Data/DesignedReports/test.frx");
using (FileStream file = new FileStream(pathToSave, FileMode.Create))
{
reportForSave.CopyTo(file);
}
}
return View();
}
```
Also you need to create a simple view in \Views\Home\SaveDesignedReport.cshtml.

```html
<h2>@ViewBag.Message</h2>
```

Good article about using the Online Designer in ASP .Net Core can be found [here](https://www.fast-report.com/en/blog/196/show/).

## WebReport Examples

You can see some examples [here](https://github.com/FastReports/FastReport/tree/master/Demos/Core).

Expand Down

0 comments on commit d8d58fc

Please sign in to comment.