RatiboR
RatiboR

Reputation: 65

Office Addin command taskpane button icon is not shown

I'm developing Word Web Add-in and facing ribbon button icon issues; it's not showing up.

I've searched a lot and seen a few questions here but nevertheless, I've passed all suggestions from there and it still doesn't work.

I'm using Add-in Commands and I have only one ribbon button whose icon points to my server over https. I can grab image through any browser.

There are a couple of odd things:

Here is my manifest:

<!-- from Group -->
<Control xsi:type="Button" id="TaskpaneButton">
    <Label resid="TaskpaneButton.Label"/>
    <Supertip>
        <!-- ToolTip title. resid must point to a ShortString resource. -->
        <Title resid="TaskpaneButton.Label"/>
        <!-- ToolTip description. resid must point to a LongString resource. -->
        <Description resid="TaskpaneButton.Tooltip"/>
    </Supertip>
    <Icon>
        <bt:Image size="16" resid="tpicon_16x16"/>
        <bt:Image size="32" resid="tpicon_32x32"/>
        <bt:Image size="80" resid="tpicon_80x80"/>
    </Icon>
    <!-- This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFunction or ShowTaskpane. -->
    <Action xsi:type="ShowTaskpane">
        <TaskpaneId>ButtonId1</TaskpaneId>
        <!-- Provide a url resource id for the location that will be displayed on the task pane. -->
        <SourceLocation resid="Taskpane.Url"/>
    </Action>
</Control>

<!-- from Resources -->
<bt:Images>
    <bt:Image id="tpicon_16x16" DefaultValue="https://validurl.com/wa/Images/R16X16.png"/>
    <bt:Image id="tpicon_32x32" DefaultValue="https://validurl.com/wa/Images/R32X32.png"/>
    <bt:Image id="tpicon_80x80" DefaultValue="https://validurl.com/wa/Images/R80X80.png"/>
</bt:Images>

HTTP trace when fetching the image:

HTTP/1.1 200 OK
Date: Mon, 05 Feb 2018 22:51:38 GMT
Server: Jetty(9.3.11.v20160721)
Last-Modified: Mon, 05 Feb 2018 16:24:36 GMT
Content-Type: image/png
Accept-Ranges: bytes
Content-Length: 835
Vary: User-Agent
Cache-Control: no-cache, no-store, must-revalidate, private
Pragma: no-cache
Expires: 0
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000; includeSubDomains

Upvotes: 1

Views: 1016

Answers (2)

RatiboR
RatiboR

Reputation: 65

Thanks to @Marc LaFleur - MSFT the issue is solved. In order to make it work I would not have turned off Cache-Control but set it to public, max-age=<value you want>. As to Pragma header it should be turned off totally. So now it works.
There is one more useful link Office-Add-in-Commands-FAQ section Debug: Icons not showing

Upvotes: 0

Marc LaFleur
Marc LaFleur

Reputation: 33094

This is being caused by your Cache-Control header. Word for Windows caches the ribbon image for performance reasons. When you specify that it cannot cache these images then Word will simply fail to load them.

Cache-Control: no-cache, no-store, must-revalidate, private

You need to configure your web server such that images do not have a Cache-Control header added to them.

Upvotes: 1

Related Questions