View Single Post
 
Old 03-27-2015, 03:01 AM
dsimon14 dsimon14 is offline Windows 7 64bit Office 2003
Novice
 
Join Date: Mar 2015
Posts: 2
dsimon14 is on a distinguished road
Default How to set the Content Control placeholder default text

Hi,

I'm designing word documents as templates for my web application. I'm using content controls to be able to get the content of the document in Java. I'm using Word 2010.

When you create a content control, it sets a default placeholder text where it's written "Click here to enter text" (for input fields for example). I like this feature because my users can just click anywhere and it's automaticaly replaced by the text typed.

What I'd like to do is to set The default message in French and German for my others documents.

I've tried some tricks but nothing works. Something like that :

Code:
 
Sub temp1()
  Dim aCC As ContentControl
  For Each aCC In ActiveDocument.ContentControls
       aCC.SetPlaceholderText , , "Now I can see the placeholder text"
  Next aCC
End Sub
I've read somewhere that I needed to turn on the formDesign mode, Toggling to design mode is working but it still doesn't work and I can't toggle it back :

Code:
Dim toggleDesignMode As Boolean
toggleDesignMode = ThisDocument.FormsDesign
 If (toggleDesignMode) Then
    ThisDocument.ToggleFormsDesign
 End If
 
Dim aCC As ContentControl
  For Each aCC In ActiveDocument.ContentControls
    If aCC.Tag = "SecteurActivite" Or aCC.Tag = "Pays" Then
        aCC.SetPlaceholderText , , "Choose an item."
    ElseIf aCC.Tag = "NomClient" Or aCC.Tag = "Site" Or aCC.Tag = "DureeProjet" Or aCC.Tag = "AnneeRealisation" Or aCC.Tag = "Description" Or aCC.Tag = "LibelleProjet" Or aCC.Tag = "SousTitre" Or aCC.Tag = "Benefices" Then
         aCC.SetPlaceholderText , , "Click here to input text"
    Else
        aCC.SetPlaceholderText , , "no reason to display this one"
    End If
 
  Next aCC
'This is not working !
ThisDocument.ToggleFormsDesign
I would be really thankful for any help !
Reply With Quote