.NET Framework Bookmark and Share   
 index > .NET Base Class Library > Word 2007, ContentControl, can I insert HTML
 

Word 2007, ContentControl, can I insert HTML

Hi

I have a Word 2007 .docx file which has a number of content controls.

I am looping around each of the controls, and when I hit a specific control instead of inserting text, I want to insert HTML code. The content control is the content of a publication (the other controls are dates, keywords, etc) and the HTML incudes formatting, tables, info, etc.

Is there a way I can take the HTML and put it in to the text please?

The code is below

private void RefreshContentControls(Document doc)
{

   xmlPart = doc.CustomXMLParts.Add(this.metaData, missing);
   foreach (ContentControl ctrl in doc.ContentControls)
   {
      ctrl.XMLMapping.SetMapping("/root.bookmark[@name='" + ctrl.Tag + "']", "", xmlPart);
      ctrl.SetPlaceholderText(null, null, string.Empty);
      //So want to add....
      //if (ctrl.Tag.Equals('Content'))
      //{
      //   ctrl.XMLMapping.SetMapping("/root.bookmark[@name='" + ctrl.Tag + "']", "", xmlPart but as HTML);
      //}
   }
}<br/><br/><br/><br/><br/>Thanks<br/>
  • Moved byJialiang Ge [MSFT]MSFTThursday, September 24, 2009 3:38 AMsuggested VSTO forum and Office automation newsgroup (From:.NET Base Class Library)
  •  
wonderbison

Hello wonderbison

Office automation is not a part of .NET Base Class Library. If you are using VSTO, I can help you move the thread to the VSTO forum, otherwise, please post the issue to the microsoft.public.office.developer.automation newsgroup. The reason why we recommend posting appropriately is you will get the most qualified pool of respondents who can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

Regards,

Jialiang Ge


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Jialiang Ge [MSFT]

You can use google to search for other answers

Custom Search

More Threads

• Meger two AVI files in array byte and write in single AVI File or WMV format
• How to Convert any Document to PDF without using any External tool
• Constructing String Arrays
• Missing References
• porble to read RTF file unreadble image string produce the image.
• Is DirectX Managed supported now or is the future Xna?
• Windows forms msdn documentation doubts
• Dictionary Dilemma
• How do I manage certificates?
• Problem using RSAPKCS1SignatureFormatter