Set up the report viewer in .NET 8.0, load a template, and connect the component to the application.

Building options in the controller. Configure a StiNetCoreViewerOptions object and hand it to the view through ViewBag:
public IActionResult Index()
{
    var viewerOptions = new StiNetCoreViewerOptions();
    viewerOptions.Actions.GetReport = "GetReport";
    viewerOptions.Actions.ViewerEvent = "ViewerEvent";
    viewerOptions.Appearance.FullScreenMode = true;
    viewerOptions.Toolbar.Zoom = 75;
    viewerOptions.Toolbar.ViewMode = StiWebViewMode.MultiplePages;
    viewerOptions.Theme = StiViewerTheme.Office2013WhiteViolet;

    ViewBag.ViewerOptions = viewerOptions;
    return View();
}

Using them in the view. The view simply renders the options it was given:
@Html.StiNetCoreViewer(@ViewBag.ViewerOptions as StiNetCoreViewerOptions)

Moving the configuration into the controller keeps the view clean and lets you decide the zoom, view mode, theme and other settings dynamically for each request.

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.