Clearing removed (no longer used) objects from the document

  • Hi

    I'm getting really big template binaries due orphaned objects that were manually deleted from the document and I'm wondering how can I find them and if possible how can I delete them completely from my template in order to shrink it, being careful to not delete actual/still used data.

    My biggest template example that I have here is 11 mb size and has 2200 Document.RtfData.Count, but I assume there are bigger templates in some of my biggest customers.

    When I call TWPRichText.Clear I'm able to erase everything, but I also lose the data that I want to keep (the visible data).

    Any help would be highly appreciated.

  • Hi

    Thanks for the answer... I think I figure this out: I'm deleting all invisible RTFDataBlocks using this pseudo-code:

    The downsides:

    1 - The Document needs to be loaded in desgin time;

    2 - The Document needs to be focused (Document.SetFocus())

    I had more than 2k useless objects loaded in the TWPRichText component!!