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: Oldest
  1. Anonymous
    2025-01-18T07:34:30+00:00

    Dear James,

    Thanks for your updates.

    You can just edit insert the whole HTML code with CSS in a .txt file, save it as a .html file and then check it if the image and the caption is showed fine.

    If yes, rename the file from file.html to file.aspx to convert it.

    Welcome to share any updates at your convenience if you need further help.

    Thank you for your time and effort.

    Sincerely

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2025-01-24T06:59:22+00:00

    Dear James,

    May I know whether you need further help on this issue?

    Your effort and time are greatly appreciated!

    Sincerely

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2025-01-25T04:48:03+00:00

    Yes, further help please.

    I tried your embedding solution, but first I tried with a simpler HTML page that just has text (including a heading). I placed that HTML file, renamed to "testHTML.apsx", into the Documents library. I then made a page with an embed web part, using the URL "

    https://[tenant].sharepoint.com/sites/[site]/Shared%20Documents/testHTML.aspx".

    As a result, the embed web part displays, "Sorry, something went wrong" "File Not Found."

    However, if I then delete testHTML.apsx from the Documents library, the embed web part instead displays, "404 NOT FOUND" in a monospaced font. So I can tell that the "File Not Found" in the first message is a lie, or at least is not referring to finding the file that I put in the library.

    In your instructions, when you said "save the file to the site library," did you mean a library other than the Documents library?

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2025-01-25T08:54:12+00:00

    Dear James,

    Thanks for your updates.

    We are glad to help you further.

    About "did you mean a library other than the Documents library?", no, I think that you can save the file in any library.

    May I know whether the HTML file can be opened fine in the browser directly on your computer?

    Some related screenshots of the issue are appreciated.

    Note: Remove nay private information before uploading the screenshots.

    Meanwhile, if the HTML file isn't private, please post the code here for us to do a test in our environment.

    If you can't share it here directly, welcome to let us know and we'll take the next step to collect the file.

    Your effort and time are greatly appreciated!

    Sincerely

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments