none
Word - Picture Content Control RRS feed

  • Question

  • I am writing word 2010 add-in.

     

    In one of ribbon button click event handler, am inserting building block (in footer section) in active document. Building block has picture content control. After inserting building block, when I try to set the image for picture control everything works fine if active document is docx file but if active document is doc (old version) file, am unable to set image for picture content control and get error message as “This document is password protected and you are not allowed to any content here” and on click of OK, COM exception is thrown.

    My code is as

    System.Drawing.Bitmap img = new System.Drawing.Bitmap(imageFilePath + "\\" + imageFileName);

    PictureContentControl picCC = contentControl.GetPictureContentControl();

    picCC.Image = img;

     


    Manoj
    Wednesday, July 6, 2011 1:57 PM

Answers

  • Hi Manoj

    Content controls were introduced in Office 2007, at the same time as the docx file format. Content controls are not supported in the old *.doc file format, which would explain why Word isn't happy when you try to insert one into a *.doc file...


    Cindy Meister, VSTO/Word MVP
    Wednesday, July 6, 2011 2:24 PM
    Moderator