| View previous topic :: View next topic |
| Author |
Message |
paulocordeiro Newbie

Joined: 29 Apr 2008 Posts: 2
|
Posted: Tue Apr 29, 2008 6:03 am Post subject: Cursor, Text and table |
|
|
Hello,
In my document exist a text i need find it and change to table.
How set cursor position based in find text?
Delphi code:
oTable := oDoc.createInstance('com.sun.star.text.TextTable');
oTable.initialize( 7, 5 );
oText := oDoc.Text;
otextcursor := otext.createTextCursor;
oText.InsertTextContent( otextcursor, oTable, False );
Paulo |
|
| Back to top |
|
 |
paulocordeiro Newbie

Joined: 29 Apr 2008 Posts: 2
|
Posted: Wed Apr 30, 2008 12:25 pm Post subject: [Solved] Cursor, Text and table |
|
|
Based in posts:
http://www.oooforum.org/forum/viewtopic.phtml?t=68332
http://www.oooforum.org/forum/viewtopic.phtml?t=27199
my problem is solved with code:
| Code: |
objSearch := oDoc.createSearchDescriptor;
objSearch.SearchString := '{table_position}';
objFound := oDoc.findAll(objSearch);
for n:= 0 to objFound.Count - 1 do
begin
if not isNullEmpty(objFound.getByIndex(n)) then
begin
//Get the cursor position
objCursor := objFound.getByIndex(n).Text.createTextCursorByRange(objFound.getByIndex(n));
//Remove the searched for text in the document
objCursor.String := '';
//create sample table
oTable := oDoc.createInstance('com.sun.star.text.TextTable');
oTable.initialize( 7, 5 );
//insert table in found position
oDoc.text.InsertTextContent( objCursor, oTable, False );
end;
end;
|
Paulo |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|