Dear Sir,
 
I tried executing the Following code. The mxDocFactory is unable to open the
footnote service.
How to resolve this error.
 
Request you to please reply to this problem.
 
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 );
         
         // Create a text cursor for the foot note text
         XTextRange xRange = (XTextRange ) UnoRuntime.queryInterface (
             XTextRange.class, xSimple.createTextCursor() );
         
         // And insert the actual text of the footnote.
         xSimple.insertString ( 
             xRange, " The numbers were generated by using
java.util.Random", false );
     }
     catch (Exception e) 
     {
         e.printStackTrace ( System.out );
     }

 

Thanking you ,

 

Swati

Reply via email to