Report Viewer in shadow DOM
Report Viewer in shadow DOM
I have a Blazor server web app where I render reports in StiReportViewer, and I want to render them inside the Shadow DOM to prevent parent CSS from affecting the viewer, essentially creating a pure standalone report view within my app.
is there any idea or implementation?
Thanks.
is there any idea or implementation?
Thanks.
-
Max Shamanov
- Posts: 1104
- Joined: Tue Sep 07, 2021 10:11 am
Re: Report Viewer in shadow DOM
Hello.
We would need more time to get an answer for you.
We will let you know as soon as we have any results.
Thank you.
#19612
We would need more time to get an answer for you.
We will let you know as soon as we have any results.
Thank you.
#19612
-
Max Shamanov
- Posts: 1104
- Joined: Tue Sep 07, 2021 10:11 am
Re: Report Viewer in shadow DOM
Hello,
We don't have a ready-made solution, but we recommend using IFRAME for this purpose, as it is the most reliable and cleanest method.
If this is not possible in your project, you can try CSS sandboxing, i.e. create a div with the .viewer-sandbox style and reset all basic styles:
However, this method will be less reliable than a separate IFRAME, in which styles are guaranteed not to be mixed up.
Thank you.
We don't have a ready-made solution, but we recommend using IFRAME for this purpose, as it is the most reliable and cleanest method.
If this is not possible in your project, you can try CSS sandboxing, i.e. create a div with the .viewer-sandbox style and reset all basic styles:
Code: Select all
<div class="viewer-sandbox">
<StiBlazorViewer Report="@Report" />
</div>
.viewer-sandbox {
all: initial;
display: block;
box-sizing: border-box;
}
.viewer-sandbox * {
all: revert;
box-sizing: border-box;
}Thank you.
Re: Report Viewer in shadow DOM
Hello,
with that Css styles, it resets all Viewer elements and toolbar button, like when you hover or click on the view mode button in the toolbar the dropdown menu goes to button of the page.
with that Css styles, it resets all Viewer elements and toolbar button, like when you hover or click on the view mode button in the toolbar the dropdown menu goes to button of the page.
-
Max Shamanov
- Posts: 1104
- Joined: Tue Sep 07, 2021 10:11 am
Re: Report Viewer in shadow DOM
Hello,
We apologize if we did not fully understand your question.
Could you please provide more details about your issue?
Thank you.
We apologize if we did not fully understand your question.
Could you please provide more details about your issue?
Thank you.
Re: Report Viewer in shadow DOM
Hello Max,
i mean with this (.viewer-sandbox *) all the viewer elements css styles gets reset and no css is applied and is overwritten by this css => (all: revert;).
i will try with iframe.
Thanks.
i mean with this (.viewer-sandbox *) all the viewer elements css styles gets reset and no css is applied and is overwritten by this css => (all: revert;).
i will try with iframe.
Thanks.
Re: Report Viewer in shadow DOM
I have another custom font issue with the latest version (20261.4). In the report viewer, everything looks good and the fonts are applied, but in the browser print dialog, when I press Print, none of my custom fonts are applied.