none
How To Delete a Content Control Programmatically RRS feed

  • Question

  • Greetings,

    Does anyone know if it is possible to delete a content control locked for editing from an App for Office? I see here that you can create a binding to a rich text content control. If it wasn't locked for editing, then I could take advantage of the 'remove content control upon editing' setting.

    Ideally I'd just like to be able to use Binding.SetDataAsync to replace the content control with nothing (which is equivalent to deletion), but it seems like, based on my experimentation, that SetDataAsync only ever affects the text in the content control, not the content control itself, so when I try to use SetDataAsync for a content control locked for editing, the method fails due to an "Internal Error".

    Saturday, July 5, 2014 4:59 AM

Answers

  • Hi,

    The binding in apps is used to access the data contained in the associated region of the document or spreadsheet. Creating bindings provides the following value to your app:

    •Permits access to common data structures across supported Office applications, such as: tables, ranges, or text (a contiguous run of characters).

    •Enables read/write operations without requiring the user to make a selection.

    •Establishes a relationship between the app and the data in the document. Bindings are persisted in the document, and can be accessed at a later time.

    So I am afraid, we can't delete the rich content control at current version. I suggest you submiting the feedback from link below:
    UserVoice

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Monday, July 7, 2014 3:05 AM
    Moderator

All replies

  • Hi,

    The binding in apps is used to access the data contained in the associated region of the document or spreadsheet. Creating bindings provides the following value to your app:

    •Permits access to common data structures across supported Office applications, such as: tables, ranges, or text (a contiguous run of characters).

    •Enables read/write operations without requiring the user to make a selection.

    •Establishes a relationship between the app and the data in the document. Bindings are persisted in the document, and can be accessed at a later time.

    So I am afraid, we can't delete the rich content control at current version. I suggest you submiting the feedback from link below:
    UserVoice

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Monday, July 7, 2014 3:05 AM
    Moderator
  • Thanks Fei.

    To anyone else with the same issue, I played around with it, and was able to delete a content control by binding to a selection that contained both the content control and an additional character beyond the content control, and then writing to that selection.  This doesn't fit my needs, though, since I can't have a space after every content control.  If anyone knows of a character or other markup that I could use that would be invisible to the user instead, please let me know.

    Gabrielle

    Sunday, July 20, 2014 3:47 PM