Hi,

I have a code:

// -----------------------------------------------------------------

TextDocument resDoc = TextDocument.loadDocument( someInputStream );

Section section = resDoc.getSectionByName( "Section1" );  // this section does exist in the document

// create new node form String

String fragment = "<text:p text:style-name=\"P13\"><text:span text:style-name=\"T1\">Test</text:span></text:p>";

Node node = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( new InputSource( new StringReader( fragment ) ) ).getDocumentElement();
node = section.getOdfElement().getOwnerDocument().importNode( node, true );

// append new node into section

section.getOdfElement().appendChild( node );

// -----------------------------------------------------------------

The code runs without a problem. But nothing does appear in the section in the result document. Please any idea how can I add new nodes created from string into the odf document?

Thanks,

David

Reply via email to