Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9155533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:36:52+00:00 2026-06-17T12:36:52+00:00

c# VSTO How to insert an image with some caption in a rich text

  • 0

c# VSTO

How to insert an image with some caption in a rich text contentcontrol in word 2010.
the property formattedtext doesnt even accept a range object

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:36:53+00:00Added an answer on June 17, 2026 at 12:36 pm

    Adding an image to a rich text content control is pretty simple, all you have to do is add it to the Range.InlineShapes collection.

    To retrieve images from a Word document you can do the following:

    1. Loop through all the content controls in the document
    2. If content control has an image, copy it to clipboard
    3. Retrieve the Image object from clipboard
    4. Do any required processing on the image(save to disk,database e.t.c)

    Here’s an example:

    Add a reference to System.Windows.Forms.dll to be allow use of the Clipboard class

        string imagePath = @"D:\microsoft.jpg";
        string title = "Microsoft";
        Word.ContentControls cc = this.Application.ActiveDocument.ContentControls;
    
        //Add a rich content control,add an image to the rich content control
        var richContentControl = cc.Add(Word.WdContentControlType.wdContentControlRichText);
        richContentControl.Range.FormattedText.Text = title;
    
        if (System.IO.File.Exists(imagePath))
        {
            Word.InlineShape image = richContentControl.Range.InlineShapes.AddPicture(imagePath);
            image.Height = 70;
            image.Width = 100;
    
            //Retrieve all images from content controls and save to disk
            foreach (Word.ContentControl c in cc)
            {
                if (c.Range.InlineShapes.Count > 0)
                {
                    foreach (Word.InlineShape shape in c.Range.InlineShapes)
                    {
                        shape.Range.Copy();
                        if (System.Windows.Forms.Clipboard.ContainsImage())
                        {
                            System.Drawing.Image clipboardImage = Clipboard.GetImage();
                            string path = System.IO.Path.Combine(@"D:\imageName.jpg");
                            clipboardImage.Save(path);
                        }
                        Clipboard.Clear();
                    }
                }
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How using VSTO and Word 2003 can I insert text after a table I've
I have some VSTO code which generates a Word 2003 document by copying and
I have a VSTO addin for Word. Developed with Visual Studio 2010 (for Word
My Outlook 2010 add-in (using VSTO) does some web-service calls in a different thread
Does VSTO 2008 work for Office 2010 or will it only be VSTO 2010?
I am writing a VSTO addin for Word 2007. When the user selects File->New,
I am using VSTO to fill data into a table in a Microsoft Word
I'm trying to migrate a VBA macro to VSTO (Word). In the macro I
I am developing a VSTO 2010 Office 2007 Outlook Add-In deployed from Click-Once. On
I'm looking through some VSTO excel code and there seems to be a major

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.