Re: [api-dev] Footnote service not starting

2010-12-06 Thread Mathias Bauer

On 29.11.2010 09:27, Swati Soni wrote:

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" ) );


I don't know what "mxDocFactory" is in your code. If I take it from a 
text document, creating a footnote works as expected, e.g. in Basic:


Sub Main

  obj = ThisComponent.createInstance("com.sun.star.text.Footnote")
  print obj.dbg_supportedinterfaces

End Sub

This will display all interfaces of the implementation class SwXFootnote.

Regards,
Mathias

--
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
Please don't reply to "nospamfor...@gmx.de".
I use it for the OOo lists and only rarely read other mails sent to it.

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] Footnote service not starting

2010-11-30 Thread Swati Soni
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