Search code examples
c++buildertxmldocument

new TXMLDocument in Borland C++ Builder


Is it possible for me to create and destroy a TXMLDocument by myself in Borland C++ Builder? I've tried but borland keeps telling me that TXMLDocument is (and must be) an IDE managed component.

Also, the only reason that I want to do this is that TXMLDocument sort of crashes: I get the TXMLDocument and 'Gets' a workbook from it, sets some document properties (the xml is saved as an Excel-file later), and the I add some styles. Ok, then I add a worksheet and then all the cells that I want with proper formatting and then I save it. At this point everything is OK.

Then I want to save another Excel-file. Since the IDE doesn't let me delete and recreate the TXMLDocument I try to delete just the worksheet form it. When I try this (in debug mode) the IDE goes in to line step mode in the CPU tab (showing some assembler):

ntdll.DbgBreakPoint:
77A07DFE CC               int 3
77A07DFF C3               ret

Solution

  • You need to do something like this instead:

    _di_IXMLDocument Doc = NewXMLDocument(); 
    

    I can't remember the gory details of why, but that should point you in the right direction.

    There's more info on the Codegear website here.