کانال بله, جهت پشتیبانی و اطلاع رسانی کانال بله, جهت پشتیبانی و اطلاع رسانی
عضویت

آموزش خروجی گرفتن از گزارشات (Exporting) در Stimulsoft

آموزش خروجی گرفتن از گزارشات (Exporting) در Stimulsoft

می توانید از گزارش خود در فرمت های مختلفی چون PDF, HTML, Word, Excel, XPS, RTF، تصویر، متن و ... خروجی بگیرید.


خروجی گرفتن از گزارشات (Exporting)

متد export تنطیمات اضافه ای برای viewer لازم ندارد. اگر می خواهید عملیات خاصی قبل از Export کردن انجام دهید باید یک ExportReport action تعریف کنید.


Index.cshtml
...
@Html.StiNetCoreViewer(new StiNetCoreViewerOptions() {
Actions =
{
ExportReport = "ExportReport"
}
})
...


HomeController.cs
...
public IActionResult ExportReport()
{
// Some code before export
// ...
 
return StiNetCoreViewer.ExportReportResult(this);
}
...

تنظیمات Export

هر فرمت خروجی گرفتن از گزارش تنظیمات متفاوتی دارد، و هر یک از این تنظیمات مقدار پیش فرض خود را دارد. برای تغییر این مقادیر پیش فرض، به DefaultSettings property از viewer نیاز داریم.


Index.cshtml
...
@Html.StiNetCoreViewer(new StiNetCoreViewerOptions() {
Exports =
{
DefaultSettings =
{
ExportToPdf =
{
ImageQuality = 0.75f,
ImageFormat = Stimulsoft.Report.Export.StiImageFormat.Color
},
ExportToHtml =
{
ExportMode = Stimulsoft.Report.Export.StiHtmlExportMode.Div,
UseEmbeddedImages = true
}
}
}
})
...

می توانید کل پنجره های مربوط به Export را مخفی کنید و خروجی گرفتن با تنظیمات پیش فرض انجام می شود. به این منظور کافی است مقدار ShowExportDialog property را به false مقداردهی کنید.


Index.cshtml
...
@Html.StiNetCoreViewer(new StiNetCoreViewerOptions() {
Exports =
{
ShowExportDialog = false
}
})
...

HTML5 Viewer بیش از 30 فرمت خروجیی گرفتن در اختیار می گذارد. گاهی لازم است فرمت هایی را حذف کنیم. این کار برای ساده کردن UI و کار با viewer لازم است. برای غیرفعال کردن format های موردنظر، کافی است مقادیر property هایی از viewer که در زیر لیست شده اند را false مقداردهی کنید.


Index.cshtml
...
@Html.StiNetCoreViewer(new StiNetCoreViewerOptions() {
Exports =
{
ShowExportToDocument = true,
ShowExportToPdf = true,
ShowExportToXps = true,
ShowExportToPowerPoint = true,
ShowExportToHtml = true,
ShowExportToHtml5 = true,
ShowExportToMht = true,
ShowExportToText = true,
ShowExportToRtf = true,
ShowExportToWord2007 = true,
ShowExportToOpenDocumentWriter = true,
ShowExportToExcel = true,
ShowExportToExcelXml = true,
ShowExportToExcel2007 = true,
ShowExportToOpenDocumentCalc = true,
ShowExportToCsv = true,
ShowExportToDbf = true,
ShowExportToXml = true,
ShowExportToDif = true,
ShowExportToSylk = true,
ShowExportToImageBmp = true,
ShowExportToImageGif = true,
ShowExportToImageJpeg = true,
ShowExportToImagePcx = true,
ShowExportToImagePng = true,
ShowExportToImageTiff = true,
ShowExportToImageMetafile = true,
ShowExportToImageSvg = true,
ShowExportToImageSvgz = true
}
})
...

با HTML5 Viewer component می توانید کل منوی export را غیرفعال کنید. برای این کار، مقدار ShowSaveButton property را به false مقداردهی کنید.


 
Index.cshtml
...
@Html.StiNetCoreViewer(new StiNetCoreViewerOptions() {
Toolbar =
{
ShowSaveButton = false
}
})
...

1398/07/08 2847 0
نظرات شما

نظرات خود را ثبت کنید...