MSDN > Home page del forum > Visual Studio Tools for Office > How to find controls in customized document and delete them
Formula una domandaFormula una domanda
 

Con rispostaHow to find controls in customized document and delete them

  • sabato 4 luglio 2009 21.43Stanislav Kroschenko Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    Hello

    I would like to customize my document and i need to find combobox controls, check if property Text is empty or not, and if empty delete this whole line on which control is.

    I think that i need loop through all controls, check if it is control which i need, and then check text property.
    However i can't get Name property of control and i don't know how to delete whole line with my controle.

    Please help, thanks in advance

Risposte

Tutte le risposte

  • lunedì 6 luglio 2009 8.35Cindy MeisterMVP, ModeratoreMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    Hi Stanislav

    Which application (Word, something else)?

    Which version of the application?

    What kind of combobox controls? (If you don't know, describe the exact steps used to create them in the document.)

    Office documents can, depending on the parent application, host many different types (technologies) of controls. Before we can tell you what you need in the object model we require this additional information.
    Cindy Meister, VSTO/Word MVP
  • martedì 7 luglio 2009 23.34Stanislav Kroschenko Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    Hi Cindy

    I'm customizing a document of Word 2007 application with VSTO 3.0.
    I am using the latest kind of combobox from this class Microsoft.Office.Tools.Word.ComboBoxContentControl.

    Thanks

  • mercoledì 8 luglio 2009 8.15Cindy MeisterMVP, ModeratoreMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     Con risposta
    Hi Stanislav

    Thank you for the additional information :-)

    If the controls have been placed in the document at design time, then they cannot be deleted at run-time. Only controls inserted at run-time can be deleted from a document. The discussion in this MSDN article may be of some assistance.
    Cindy Meister, VSTO/Word MVP
  • mercoledì 8 luglio 2009 17.17Stanislav Kroschenko Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    Thanks, this article really helped me.