Rich Text Content Controls with binding to Custom XML make the document grow RRS feed

All replies

  • The general rule with Word releases is that improvements and fixes aren't generally announced until they are actually released, although if an idea gets attention via uservoice you may see some feedback there such as "we're working on it." If you have anything to add, such as a suggestion on how your requirement could be achieved, I'd post it as a reply to the existing post in uservoice. It is possible that this issue is becoming more of a problem for more people because (as far as I can remember) the current Javascript addin model only really lets the programmer access rich text controls - they have no option but to use that type.

    I looked at he original thread that you reference and I would agree with David_JunFeng 's understanding in there that this is not actually a bug. It has always been the case that, other than the special case where the content control is initially mapped to an element in the Custom XML store, the Custom XML element mapped to the content control will contain a complete  OOXML representation of the content of the control.

    I think Pieratt 's post in that thread is a bit ambiguous, because his text can be read as stating that an XML element mapped to a rich text content control contains the complete OOXML for the entire document containing the control. In that case, the size increase would look "exponential". But I think you would only see exponential document growth if you had a lot of nested mapped rich text controls, e.g. if you had the following nested controls

    [ control a [ control b [ control c ] ] ]

    then the document would contain the OOXML corresponding to control c in any element mapped to c, and would contain the OOXML corresponding to b in any element mapped to b, and that in turn would contain the OOXML corresponding to c again, and so on. (I haven't actually verified that Word does it that way.

    What I assume you are looking for, at least in the case where controls are not nested, is a simple way of representing rich text that does not require the entire infrastructure of an OOXML document to be present - perhaps, e.g. an HTML representation. But at present you do not seem to be able to. (I tried, and it didn't work, but I may not have @escaped@ the HTML correctly). Even if you could start with one, as soon as you make a change to the content of the control Word will write over that with the full OOXML format. But because Word needs to be able to represent any kind of rich text that can occur in a Word document, it is not actually that unreasonable to choose the OOXML format to do it, because in fact it is the only format that has a chance of doing that.

    As far as the original poster's requirement was concerned, if all they needed to do was ensure that the entire content control' text was formatting a particular way, e.g. all in italic, then I think they could probably do that by using a plain text content control instead, and applying the necessary format to any part of the content.

    Peter Jamieson

    Thursday, November 1, 2018 5:09 PM
  • Actually, we do have more requirements than just formatting the entire content control: We also need the content of the corresponding XmlPart that ist bound to the Content Control.

    In case of bound Rich Text Content Controls, the content of the XmlPart corresponds not - as we expected - to the content displayed in the Content Control.

    That's what leads me to the conclusion that bound Richt Text Content Controls will remain useless.

    Our solution: Don't use binding, as unbound Richt Text Content Controls don't have this issue. (Instead, we have re-written ourselves the code that updates the controls from the Xmlpart.)

    Kind regards


    Friday, November 9, 2018 2:46 PM