Is it possible to remove hyperlink tags during Report Print?
Posted: Wed Nov 13, 2024 11:35 am
I'm working on an ASP.NET project that includes a controller endpoint extending StiNetCoreViewer for report rendering
When the report displays on the web, we have texts that are wrapped inside hyperlink tags (and also another text decoration tag that is <u>). However, we would want to remove the hyperlink tags while preserving the the state of the report.
We are using a function A that uses regex to replace the hyperlinks and text decoration tags with empty string. We are attempting to catch the StiAction.PrintReport action, then we would re update the reportTemplate with function A. Then we call StiReport.LoadFromJson(reporttemplate). For the dataset, we also apply function A to data in format of json, then bind it back to data set StiJsonToDataSetConverterV2.GetDataSet and call StiReport.RegData again. In the end, we are calling StiNetCoreViewer.GetReportResult to render the report without hyperlinks in print preview mode.However, this would cause the whole report to re render. The previous states, such as collapsing will not be reflected in the Print Preview.
So my question is that, is it possible to execute the same logic directly on StiReport object during PrintReport event? I would want to apply the same replace logic to this part of the code.
To add on, we would want to do the same thing to the report on Export Report to PPF action.
When the report displays on the web, we have texts that are wrapped inside hyperlink tags (and also another text decoration tag that is <u>). However, we would want to remove the hyperlink tags while preserving the the state of the report.
We are using a function A that uses regex to replace the hyperlinks and text decoration tags with empty string. We are attempting to catch the StiAction.PrintReport action, then we would re update the reportTemplate with function A. Then we call StiReport.LoadFromJson(reporttemplate). For the dataset, we also apply function A to data in format of json, then bind it back to data set StiJsonToDataSetConverterV2.GetDataSet and call StiReport.RegData again. In the end, we are calling StiNetCoreViewer.GetReportResult to render the report without hyperlinks in print preview mode.However, this would cause the whole report to re render. The previous states, such as collapsing will not be reflected in the Print Preview.
So my question is that, is it possible to execute the same logic directly on StiReport object during PrintReport event? I would want to apply the same replace logic to this part of the code.
Code: Select all
case StiAction.PrintReport:
var printReport = StiNetCoreViewer.GetReportObject(requestParams);
//Remove all <a> and <u> tags from StiReport template and dataset
return StiNetCoreViewer.PrintReportResult(requestParams, printReport);