-
Notifications
You must be signed in to change notification settings - Fork 0
Update example vite #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7fb02eb
update example
pollyndos d263207
Created a new file CODEOWNERS [skip ci]
DevExpressExampleBot 53d1c43
README auto update [skip ci]
6bd23a7
update example
pollyndos f8108a7
Merge branch 'update-example-vite' of https://github.com/DevExpress-E…
pollyndos c992aa1
README auto update [skip ci]
3335e7f
update readme
pollyndos ff18dcf
Merge branch 'update-example-vite' of https://github.com/DevExpress-E…
pollyndos 2715b51
upd
pollyndos 24d80fa
update HomeComponent
pollyndos ab2dab1
update HomeComponent
pollyndos ea34d67
upd image
pollyndos ee15ece
README auto update [skip ci]
47ed359
Apply suggestions from code review
pollyndos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * @DevExpressExampleBot |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
184 changes: 92 additions & 92 deletions
184
...houtPreview/Controllers/HomeController.cs → ServerApp/Controllers/HomeController.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,92 +1,92 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics; | ||
| using System.IO; | ||
| using System.Linq; | ||
| using System.Threading.Tasks; | ||
| using DevExpress.XtraPrinting; | ||
| using DevExpress.XtraReports.UI; | ||
| using dxSampleReactReportingPrintWithoutPreview.Model; | ||
| using dxSampleReactReportingPrintWithoutPreview.PredefinedReports; | ||
| using Microsoft.AspNetCore.Mvc; | ||
| namespace dxSampleReactReportingPrintWithoutPreview.Controllers | ||
| { | ||
| [Route("api/[controller]")] | ||
| public class HomeController : Controller | ||
| { | ||
| public IActionResult Index() | ||
| { | ||
| return View(); | ||
| } | ||
| public IActionResult Error() | ||
| { | ||
| ViewData["RequestId"] = Activity.Current?.Id ?? HttpContext.TraceIdentifier; | ||
| return View(); | ||
| } | ||
| [HttpGet("[action]")] | ||
| public async Task<object> Print() | ||
| { | ||
| var report = new TestReport(); | ||
| using (var ms = new MemoryStream()) | ||
| { | ||
| await report.ExportToPdfAsync(ms, new DevExpress.XtraPrinting.PdfExportOptions { ShowPrintDialogOnOpen = true }); | ||
| return File(ms.ToArray(), System.Net.Mime.MediaTypeNames.Application.Pdf); | ||
| } | ||
| } | ||
| [HttpGet("[action]")] | ||
| public ActionResult Export(string format = "pdf") | ||
| { | ||
| format = format.ToLower(); | ||
| XtraReport report = new TestReport(); | ||
| string contentType = string.Format("application/{0}", format); | ||
| using (MemoryStream ms = new MemoryStream()) | ||
| { | ||
| switch (format) | ||
| { | ||
| case "pdf": | ||
| contentType = "application/pdf"; | ||
| report.ExportToPdf(ms); | ||
| break; | ||
| case "docx": | ||
| contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; | ||
| report.ExportToDocx(ms); | ||
| break; | ||
| case "xls": | ||
| contentType = "application/vnd.ms-excel"; | ||
| report.ExportToXls(ms); | ||
| break; | ||
| case "xlsx": | ||
| contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; | ||
| report.ExportToXlsx(ms); | ||
| break; | ||
| case "rtf": | ||
| report.ExportToRtf(ms); | ||
| break; | ||
| case "mht": | ||
| contentType = "message/rfc822"; | ||
| report.ExportToMht(ms); | ||
| break; | ||
| case "html": | ||
| contentType = "text/html"; | ||
| report.ExportToHtml(ms); | ||
| break; | ||
| case "txt": | ||
| contentType = "text/plain"; | ||
| report.ExportToText(ms); | ||
| break; | ||
| case "csv": | ||
| contentType = "text/plain"; | ||
| report.ExportToCsv(ms); | ||
| break; | ||
| case "png": | ||
| contentType = "image/png"; | ||
| report.ExportToImage(ms, new ImageExportOptions() { Format = System.Drawing.Imaging.ImageFormat.Png }); | ||
| break; | ||
| } | ||
| return File(ms.ToArray(), contentType); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics; | ||
| using System.IO; | ||
| using System.Linq; | ||
| using System.Threading.Tasks; | ||
| using DevExpress.XtraPrinting; | ||
| using DevExpress.XtraReports.UI; | ||
| using ServerApp.Model; | ||
| using ServerApp.PredefinedReports; | ||
| using Microsoft.AspNetCore.Mvc; | ||
|
|
||
| namespace ServerApp.Controllers | ||
| { | ||
| [Route("api/[controller]")] | ||
| public class HomeController : Controller | ||
| { | ||
| public IActionResult Index() | ||
| { | ||
| return View(); | ||
| } | ||
|
|
||
| public IActionResult Error() | ||
| { | ||
| ViewData["RequestId"] = Activity.Current?.Id ?? HttpContext.TraceIdentifier; | ||
| return View(); | ||
| } | ||
| [HttpGet("[action]")] | ||
| public async Task<object> Print() | ||
| { | ||
| var report = new TestReport(); | ||
| using (var ms = new MemoryStream()) | ||
| { | ||
| await report.ExportToPdfAsync(ms, new DevExpress.XtraPrinting.PdfExportOptions { ShowPrintDialogOnOpen = true }); | ||
| return File(ms.ToArray(), System.Net.Mime.MediaTypeNames.Application.Pdf); | ||
| } | ||
| } | ||
| [HttpGet("[action]")] | ||
| public ActionResult Export(string format = "pdf") | ||
| { | ||
| format = format.ToLower(); | ||
| XtraReport report = new TestReport(); | ||
| string contentType = string.Format("application/{0}", format); | ||
| using (MemoryStream ms = new MemoryStream()) | ||
| { | ||
| switch (format) | ||
| { | ||
| case "pdf": | ||
| contentType = "application/pdf"; | ||
| report.ExportToPdf(ms); | ||
| break; | ||
| case "docx": | ||
| contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; | ||
| report.ExportToDocx(ms); | ||
| break; | ||
| case "xls": | ||
| contentType = "application/vnd.ms-excel"; | ||
| report.ExportToXls(ms); | ||
| break; | ||
| case "xlsx": | ||
| contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; | ||
| report.ExportToXlsx(ms); | ||
| break; | ||
| case "rtf": | ||
| report.ExportToRtf(ms); | ||
| break; | ||
| case "mht": | ||
| contentType = "message/rfc822"; | ||
| report.ExportToMht(ms); | ||
| break; | ||
| case "html": | ||
| contentType = "text/html"; | ||
| report.ExportToHtml(ms); | ||
| break; | ||
| case "txt": | ||
| contentType = "text/plain"; | ||
| report.ExportToText(ms); | ||
| break; | ||
| case "csv": | ||
| contentType = "text/plain"; | ||
| report.ExportToCsv(ms); | ||
| break; | ||
| case "png": | ||
| contentType = "image/png"; | ||
| report.ExportToImage(ms, new ImageExportOptions() { Format = System.Drawing.Imaging.ImageFormat.Png }); | ||
| break; | ||
| } | ||
| return File(ms.ToArray(), contentType); | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| using DevExpress.DataAccess.Sql; | ||
| using System.Collections.Generic; | ||
| using DevExpress.AspNetCore.Reporting.QueryBuilder; | ||
| using DevExpress.AspNetCore.Reporting.ReportDesigner; | ||
| using DevExpress.AspNetCore.Reporting.ReportDesigner.Native.Services; | ||
| using DevExpress.AspNetCore.Reporting.QueryBuilder.Native.Services; | ||
| using DevExpress.XtraReports.Web.ReportDesigner; | ||
| using DevExpress.XtraReports.Web.ReportDesigner.Services; | ||
| using DevExpress.AspNetCore.Reporting.WebDocumentViewer; | ||
| using DevExpress.AspNetCore.Reporting.WebDocumentViewer.Native.Services; | ||
| using Microsoft.AspNetCore.Mvc; | ||
|
|
||
| namespace ServerApp.Controllers { | ||
| public class CustomWebDocumentViewerController : WebDocumentViewerController { | ||
| public CustomWebDocumentViewerController(IWebDocumentViewerMvcControllerService controllerService) : base(controllerService) { | ||
| } | ||
| } | ||
| public class CustomReportDesignerController : ReportDesignerController { | ||
| public CustomReportDesignerController(IReportDesignerMvcControllerService controllerService) : base(controllerService) { | ||
| } | ||
|
|
||
| [HttpPost("[action]")] | ||
| public IActionResult GetDesignerModel([FromForm]string reportUrl, [FromServices] IReportDesignerModelBuilder designerModelBuilder, [FromForm] ReportDesignerSettingsBase designerModelSettings) { | ||
| var ds = new SqlDataSource("NWindConnectionString"); | ||
|
|
||
| // Create a SQL query to access the Products data table. | ||
| SelectQuery query = SelectQueryFluentBuilder.AddTable("Products").SelectAllColumnsFromTable().Build("Products"); | ||
| ds.Queries.Add(query); | ||
| ds.RebuildResultSchema(); | ||
|
|
||
| var designerModel = designerModelBuilder.Report(reportUrl) | ||
| .DataSources(dataSources => { | ||
| dataSources.Add("Northwind", ds); | ||
| }) | ||
| .BuildModel(); | ||
| designerModel.Assign(designerModelSettings); | ||
| return DesignerModel(designerModel); | ||
| } | ||
| } | ||
|
|
||
| public class CustomQueryBuilderController : QueryBuilderController { | ||
| public CustomQueryBuilderController(IQueryBuilderMvcControllerService controllerService) : base(controllerService) { | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.