Forum Discussion

batdan's avatar
15 years ago

Test Office Word PlaceHolder

Hi all,

how can i get the text inside a placeholder (ContentControl) in office word?

Thank's

1 Reply

  • Hi Danilo,




    Below, is a sample script demonstrating how to process all ContentControl items of a document:





    //JScript


    function Word_ContentControl()


    {


    var word = Sys.OleObject("Word.Application");


    var activeDocument = word.ActiveDocument;


    var contentControls = activeDocument.ContentControls;


    for(var i = 1; i <= contentControls.Count; i++) {


    var contentControl = contentControls.Item(i);


    Log.Message(contentControl.Title, "Tag: " + contentControl.Tag + "\r\n" + "Range: " + contentControl.Range);


    }


    }







    You can learn more about the MS Word object model here:


    http://msdn.microsoft.com/en-us/library/kw65a0we(VS.80).aspx