ReportExecution2005 HTMLFragment problem

Piotr A 1 Reputation point
2021-11-08T11:25:42.43+00:00

Hi,
If you render report using ReportExecution2005.asmx Render2 method using this device info:

<DeviceInfo>
  <Section>1</Section>
  <ActionScript>actionProxy</ActionScript>
  <HTMLFragment>True</HTMLFragment>
  <StreamRoot>streamRoot?executionId=EXECUTION_ID&amp;id=</StreamRoot>
  <ResourceStreamRoot>resourcesStreamRoot</ResourceStreamRoot>
</DevieInfo>

And HTML4.0 format.
Then on SSRS 2017 version: 14.0.600.689 (October 2017)
The output is perfectly fine and report is rendered without issues. Images are resized and everything works.
But somewhere between that version and 14.0.600.906 something has changed and the images are no longer resized. Instead the html fragment is triggering javascript error:

Uncaught TypeError: Cannot read properties of undefined (reading 'minWidth')
  at Microsoft_ReportingServices_HTMLRenderer_FitProportional.ResizeImage

Now if you dig a bit into the javascript that is included in rendered report you can see that this method is working only for IE, and before it's executed the method 'Microsoft_ReportingServices_HTMLRenderer_IsIE' is called, which looks like that in .689 version:

function Microsoft_ReportingServices_HTMLRenderer_IsIE(){return document.all?!0:!1}

And in higher version (including SSRS from SQL Server 2019):

function Microsoft_ReportingServices_HTMLRenderer_IsIE() {
    return document.all !== undefined
}

Aside from the fact that document.all is deprecated in all browsers, all browsers support it.
But only IE supports the failing element.currentStyle.minWidth property from 'ResizeImage' method in Microsoft_ReportingServices_HTMLRenderer_FitProportional "class".

Aside from this issue, keeping in mind that HTML4.0 format is also deprecated I tried to render the fragment using HTML5 renderer but it does not resize images at all.
Images are left with css classes like "resize100width".

We are actively using this to render a lot of existing reports in a 'backoffice' type of application so we can't just switch to other forms of rendering like powerBI, and at this moment our workaround was to disable the branding images on the reports.
Another way is to just simply string replace the failing method to the old one so the rendered report knows that it's not in IE browser. But the issue comes from reporting services.
It's also very worrying that the HTML5 output does not work at all if it comes to images, and that might not be all as we didn't test the rest of stuff yet using it.

Any plans/fixes planned for that?

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,799 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Joyzhao-MSFT 15,566 Reputation points
    2021-11-09T02:56:27.973+00:00

    Hi @Piotr A ,
    Thanks for your feedback.
    I recommend that please submit your issue to the Microsoft feedback at this link: https://feedback.azure.com/d365community/forum/04fe6ee0-3b25-ec11-b6e6-000d3a4f0da0. If the customer mentions the requirement multiple times, the product team may consider adding/improving this feature in the next SQL Server version. Your feedback is very valuable for us to improve our products and improve the level of service provided.
    Best Regards,
    Joy


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments