Microsoft word document Numbering changes after export-import contents of a content control

Viewed 71

In my vsto word plugin, for a document I am keeping the history of changes inside content controls. I export the content control range as HTML. The problem occurs with numbering inside document when i want to replace the content control with some previous range html. e.g.

  1. I have 4 content controls(1,2,3,4) with Numerical listing format(1.,2.,3.,4.) against range of content controls. Once I change the 2nd content control at some point with any old html(or just previous one) then the numbering in the document becomes (1.,1.,2.,3.). The numbering starts again from 1.
  2. In above scenario, if i change the 3rd content control. Then the numbering becomes (1.,2.1.,2.).

I am using Range.exportfragement() method for getting the HTML. I tried inserting range with both range.insertfile() and range.importfragement(). Both have same result.

I tried extracting the XML out of the content control -> It gives numbering correctly while inserting again, but if i export as XML then all of the child content controls inside the exported range are gone. Only html export have capability to maintain info about child content controls.

I also tried using ConvertNumbersToText() but it looses the listformatting and document numbering changes.

0 Answers
Related