Question

I have an office 2010 project where I use content controls to hide/show content (tables, textblocks, images etc. - content control in tables, cc in cells, cc around images, around textblocks, etc.) in a word document. the user can click an ActionsPane control button to hide/show the content.

my problem is, that I want to hide the content controls completely, but for some reason in some cases it doesen't help to set the range to -1/+1 to get the content control itself. If I select it via mouseselection it is still shown in the active document. fortunatly without its content. I would like the content control to be hidden completely so that it cant be selected or seen anymore. also in header/footer section.

The strangest phenomenon that I realised is a table wrapped in a content control. it gets hidden with its textcontent but it leaves one new row without textcontent behind?

Was it helpful?

Solution

playing around with

range.SetRange(range.Start - 1, range.End + 2) 
range.Move(WdUnits.wdParagraph, -1) 

did the job ...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top