Question

I am new to SSRS and do not know how many HTML functionality are feasible in SSRS Reporting. I have to learn to build reports in HTML formatting.

Is there any way to add ALT functionality of HTML in SQL Server Reporting Services (SSRS)?

Was it helpful?

Solution

Christopher Brown's answer is WRONG.

The alt tag is supported, via the ToolTip property.
I use the alt tag to set the height of the logo in JavaScript, depending on the image name "Logo xy", for that it is properly displayed in the QuirksMode HTML that SSRS generates.

SSRS Alt Text

Result

If you need separate Title and Alt-Tag text, you can write JSON in there, and modify the attributes with JavaScript on the ReportViewer.aspx page.

Something like this:

var arrimgLogo = document.querySelectorAll("img[onload^='this.fitproportional=true']");

if(arrimgLogo != null && arrimgLogo.length > 0)
{
    var img = arrimgLogo[0];

    // img.removeAttribute('height');
    // img.style.maxWidth = '100%';
    // img.style.maxHeight = '100%';


    if(img.alt != null && img.alt.toLowerCase() == "Logo SwissRe Left".toLowerCase())
    {
        img.height = 35;
    }
    else
    {
        var tP = img.parentElement;
        //console.log(tP);
        if(tP != null && tP.tagName == 'DIV' && tP.style != null)
        {
            tP.style.textAlign = "right";
            // if (parseFloat(tP.style.minWidth) != 0) tP.style.width = tP.style.minWidth;
            // if (parseFloat(tP.style.minHeight) != 0) tP.style.height = tP.style.minHeight;
        } // End if(tP != null && tP.tagName == 'DIV' && tP.style != null)
    }

} // End if(arrimgLogo != null && arrimgLogo.length > 0)

OTHER TIPS

Pinwar,

The alt attribute is not supported in SSRS, principally because the image tag is not supported. You can find a list of HTML tags & CSS styles that are supported within the report here. I did some looking and I can't find any built-in functionality that would reproduce the desired alt function. I know alt is not supposed to be rendered as a tooltip (even though older versions of IE do), but you can add tooltips to images.

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top