Is there any way to format text in SharePoint image captions?

Anonymous
2025-01-17T18:37:43+00:00

Is there any way to apply standard formatting, such as italics or font color, to captions on images in SharePoint pages? I am more interested in this for images placed in Text web parts, but I also can't format caption text for the Image web part.

Microsoft 365 and Office | SharePoint | For education | MacOS

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2025-02-08T06:08:32+00:00

Dear James,

Yes, you are right.

Based on my test, custom script needs to be enabled for the Embed web part with HTML code. The administrator can enable it every 24 hours via SharePoint Online Management Shell. Set-SPOSite https://contoso.sharepoint.com/sites/sitename -DenyAddAndCustomizePages 0

The SPFX solution is the alternative way of the custom script. It runs within the SharePoint Framework and doesn't rely on the custom script settings for its execution.

@Webbrewers, there may be no specific article about that currently. Similarly, you can see the detailed information about the SPFX part in Security considerations of allowing custom script - SharePoint in Microsoft 365 | Microsoft Learn.

Thank you for your time and effort.

Sincerely

Cliff | Microsoft Community Moderator

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

28 additional answers

Sort by: Most helpful
  1. Anonymous
    2025-01-29T08:04:31+00:00

    Dear James,

    Thanks for providing the code.

    It may need some time for me to do a test from my side. I'll update here as soon as possible.

    Thank you for your time and effort.

    Sincerely

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2025-01-28T22:32:40+00:00

    Thank you for the further anonymization. I was not concerned about the information there and wanted to make sure you had all necessary information. But cautious is best :-)

    I do not see any way to upload a file here. But the code is very short, so I will just copy&paste it into this posting:

    <html xmlns="http://www.w3.org/TR/REC-html40">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=windows-1252">
        <title>Intermediate Lab Experiments</title>
      </head>
      <body>
        <h2>Intermediate Laboratory Experiments</h2>
        <p>NOTE: Many of these pages contain copyrighted material.&nbsp; Use on this
          limited-access website is permitted.<br>
          Distribution of this material to any other online server, which would
          allow access to persons other than Geneseo students, is prohibited.</p>
      </body>
    </html>
    

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2025-01-28T07:15:07+00:00

    Dear James,

    Thanks for your updates and kindness.

    I see the issue from the screenshots you provided. We removed some private information such as the tenant name, the user name, the user image and so on to protect your privacy.

    However, to make sure that we use the same .html file in our test environment and see if there are some workarounds if we can also reproduce the same issue in our environment, we'd like you to provide the full HTML code here.

    Your effort and time are greatly appreciated!

    Sincerely

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2025-01-28T04:03:19+00:00

    There is nothing private or complicated. I will post here screenshots illustrating what I described in my last post. There is very little room for anything to be done incorrectly, the test is so simple.

    Here is the HTML file showing directly in Firefox. (1st image below) This is the entire HTML file; nothing is hidden below the screenshot. There are no images or links.

    Even after changing the file extension to ASPX, the file renders in Firefox just fine. (2nd image below)

    With that ASPX file uploaded to the Documents library (not in any folder, to simplify addresses), I made the following SharePoint page in the same site. (3rd image below) The Embed web part is the only content of the page. It is shown as it looks in the editor, so that you can see the details; the page content looks precisely the same when not in the editor. (I have clicked on "TECHNICAL DETAILS" to expand the useless message below those words.)

    If the ASPX file is deleted or renamed, so that the Embed address points at a non-exiting file, the following is what shows. (4th image below) Again, this is in the editor, but the result is precisely the same when just viewing the page.

    I have also tested taking the URL that I used in the Embed web part, and putting that straight into the browser URL bar. This shows the same result as what appears inside the Embed web part above. So, that is consistent… but not helpful.

    ImageImageImageImage

    Was this answer helpful?

    0 comments No comments