| View previous topic :: View next topic |
| Author |
Message |
sfreeman General User

Joined: 17 Feb 2009 Posts: 21
|
Posted: Thu May 28, 2009 10:58 pm Post subject: Is it possible to merge TextRanges? |
|
|
| May i know if it is possible to merge two textRanges into a single one? Thanks in advance |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8984 Location: Lexinton, Kentucky, USA
|
Posted: Fri May 29, 2009 8:05 am Post subject: |
|
|
Paragraph one
Paragraph three (paragraph two is blank)
This will merge them. | Code: | Sub Merge
oTC = ThisComponent.Text.CreateTextCursor
oTC.gotoEndOfParagraph(false)'assumes 1st paragraph has text
oTC.gotoEndOfParagraph(true) 'select the text
oTC1 = ThisComponent.Text.CreateTextCursor
oTC1.gotoNextParagraph(false)'assumes 2nd is a blank paragraph.
oTC1.gotoNextParagraph(false)'assumes 3rd has text
oTC1.gotoEndOfParagraph(true)'select the text
oTC.String = oTC.String & " " & oTC1.String 'merge
oTC1.String = "" 'delete paragraph text
oTC1.goLeft(2,true) : oTC1.String = "" 'delete blank paragraphs
End Sub
|
|
|
| Back to top |
|
 |
sfreeman General User

Joined: 17 Feb 2009 Posts: 21
|
Posted: Sat May 30, 2009 12:56 am Post subject: Thanks |
|
|
Thank you John for your reply, Can we get the textranges defined within a document?
Can we get the index of textRanges defined?
Once again thank you |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8984 Location: Lexinton, Kentucky, USA
|
Posted: Sat May 30, 2009 3:55 pm Post subject: |
|
|
| If we are talking about Writer then I don't believe there are any "defined" text ranges. |
|
| Back to top |
|
 |
sfreeman General User

Joined: 17 Feb 2009 Posts: 21
|
Posted: Mon Jun 01, 2009 3:07 am Post subject: Thank you |
|
|
| Thank you for the information |
|
| Back to top |
|
 |
|