Re: [api-dev] Problem with insertDocumentFromURL

2005-03-16 Thread Cristian Fonti
Andrew Douglas Pitonyak ha scritto:

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)
I try, but so the text to insert is append at the end of the document 
after all the RTF and not between them...
The code is like this: [docs is an array of documentURL]

 for (int i=0;idocs.length;i++) {
   TextCursor=xText.createTextCursor();
   xd=(XDocumentInsertable) 
UnoRuntime.queryInterface(XDocumentInsertable.class,TextCursor);
   xd.insertDocumentFromURL(docs[i],loadProps);
   TextCursor.gotoEnd(false);
   
TextCursor.getText().insertString(TextCursor,-,false);

}

Thanks to all...
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [api-dev] Problem with insertDocumentFromURL

2005-03-16 Thread Marc Santhoff
Am Mi, den 16.03.2005 schrieb Michael Hoennig um 21:22:
[...]
 For the second usage of gotoEnd(), also collapseToEnd() should work.  See
 reference manual for more information.
 
 And better do not use view cursors for model based functionality, as Marc
 suggested.

You're right, I assumed the moving functions are only accessible through
the view cursor (hold true only for pagination and the like), which was
false. Next time I'll think a little longer ... ;)

Marc



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



Re: [api-dev] Problem with insertDocumentFromURL

2005-03-15 Thread Cristian Fonti

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

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


Re: [api-dev] Problem with insertDocumentFromURL

2005-03-15 Thread Mathias Bauer
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...

First you should check if the same happens when you insert the file from
the GUI. In that case you could file and issue against the Writer
component. Otherwise I hope that a Writer API expert has an idea what is
going wrong.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.


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



Re: [api-dev] Problem with insertDocumentFromURL

2005-03-15 Thread Andrew Douglas Pitonyak

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]