{
try
{
// Create a new footnote from the document factory and get it's
// XFootnote interface
XFootnote xFootnote = (XFootnote) UnoRuntime.queryInterface(
XFootnote.class, mxDocFactory.createInstance (
"com.sun.star.text.Footnote" ) );
// Set the label to 'Numbers'
xFootnote.setLabel ( "Numbers" );
// Get the footnotes XTextContent interface so we can...
XTextContent xContent = ( XTextContent ) UnoRuntime.queryInterface (
XTextContent.class, xFootnote );
// ...insert it into the document
mxDocText.insertTextContent ( mxDocCursor, xContent, false );
// Get the XFootnotesSupplier interface of the document
XFootnotesSupplier xFootnoteSupplier = (XFootnotesSupplier)
UnoRuntime.queryInterface(XFootnotesSupplier.class, mxDoc );
// Get an XIndexAccess interface to all footnotes
XIndexAccess xFootnotes = ( XIndexAccess ) UnoRuntime.queryInterface (
XIndexAccess.class, xFootnoteSupplier.getFootnotes() );
// Get the XFootnote interface to the first footnote inserted ('Numbers')
XFootnote xNumbers = ( XFootnote ) UnoRuntime.queryInterface (
XFootnote.class, xFootnotes.getByIndex( 0 ) );
// Get the XSimpleText interface to the Footnote
XSimpleText xSimple = (XSimpleText ) UnoRuntime.queryInterface (
XSimpleText.class, xNumbers );