This example shows how to change the report viewer theme. You can set the one of 38 themes. All you need is to define only one option of the component.

First, you need to add the StiNetCoreViewer component to the view page. Also you need to pass the StiNetCoreViewerOptions object to the constructor. In the options you should set are GetReport and ViewerEvent. They are located in the Actions options group. To set the viewer theme, you should set the Theme option. The values for this option are located in the StiViewerTheme enum. For example, set the Office2022BlackPurple viewer theme:
@using Stimulsoft.Report.Web;
@using Stimulsoft.Report.Mvc;

...

@Html.StiNetCoreViewer(new StiNetCoreViewerOptions()
{
    Actions =
    {
        GetReport = "GetReport",
        ViewerEvent = "ViewerEvent"
    },
    Appearance =
    {
        BackgroundColor = System.Drawing.Color.Gainsboro
    },

    Theme = StiViewerTheme.Office2022BlackPurple
})

The OnPostGetReport action loads the report and returns the answer to the client part of the viewer using the GetReportResult() static method. In the parameters of this method, the report object should be passed. For example, load the rendered report file:
public IActionResult OnPostGetReport()
{
	var report = new StiReport();
	report.LoadDocument(StiNetCoreHelper.MapPath(this, "Reports/SimpleList.mdc"));
            
	return StiNetCoreViewer.GetReportResult(this, report);
}

The ViewerEvent action handles all the viewer events (switching pages, zooming, printing, exporting, interactivity, etc.) and returns the answer to the client using the ViewerEventResult() static method:
public IActionResult OnGetViewerEvent()
{
	return StiNetCoreViewer.ViewerEventResult(this);
}

public IActionResult OnPostViewerEvent()
{
	return StiNetCoreViewer.ViewerEventResult(this);
}

На скриншоте ниже Вы можете увидеть результат выполнения данного кода:

Changing the Viewer Theme

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.