Cristian Fonti wrote:



Andrew Douglas Pitonyak ha scritto:

Cristian Fonti wrote:

Hi to all,
i have a problem using the method insertDocumentFromURL: when i use it to insert some formatted text (font size, font color,etc...) from another document, in the destination file appear at the top of the document 2-3 blank row... the code snipplets is:


xTextDocument = (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, xcomponent);
xText = xTextDocument.getText();
TextCursor=xText.createTextCursor();
xd=(XDocumentInsertable) UnoRuntime.queryInterface(XDocumentInsertable.class,TextCursor);
xd.insertDocumentFromURL("file:///C:/file1.rtf",loadProps);
TextCursor=xText.createTextCursor();
xd=(XDocumentInsertable) UnoRuntime.queryInterface(XDocumentInsertable.class,TextCursor);
xd.insertDocumentFromURL("file:///C:/file2.rtf",loadProps);


If i add 3,4,5,6 documents the number of white rows increase...

Please someone help me....
Thanks
Cristian Fonti



I ran the following test:

 Dim sURL$
 Dim oText
 Dim oCurs

 sURL = "file:///andrew0/home/andy/film.txt"
 oText = ThisComponent.getText()
 oCurs = oText.createTextCursor()
 oCurs.gotoStart(False)
 oCurs.insertDocumentFromURL(sURL, Array())

The film.txt file, contains NO extra spaces. I did NOT see the problems that you mention.
Notice that I did use the 2.0 Beta.
I suspect that margins from the RTF file are inserted, but this is ONLY a guess. What happens with your code when you sue text files with NO top or bottom margins?



To correct the problem, i have insert TextCursor.gotoEnd(false); after the insertDocumentFromURL....

Another Question: it's possibile to insert some text (a string) between two documents RTF that i import with insertDocumentFromURL????
Thanks
Cristian Fonti

Use something similar to the following:

oCursor.getText().insertString(oCursor, "text to insert", False)

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm
Free Info:  http://www.pitonyak.org/oo.php


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to