OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Solve: insert String(NewBie)

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
zizi
General User
General User


Joined: 04 May 2012
Posts: 14

PostPosted: Sun May 06, 2012 5:58 am    Post subject: Solve: insert String(NewBie) Reply with quote

Hi,

I am using insert String to insert sentences into the presentation slide. If I need to insert a paragraph, do I still use insertString. It has the left, right and center justification but it doesn't have the "justified" option. This left me wondering if perhaps another option should be used to insert a paragraph.

Many Thanks,
zizi


Last edited by zizi on Thu May 10, 2012 3:01 am; edited 1 time in total
Back to top
View user's profile Send private message
patel
Power User
Power User


Joined: 14 Apr 2012
Posts: 54
Location: Italy

PostPosted: Sun May 06, 2012 7:01 am    Post subject: Reply with quote

http://www.pitonyak.org/oo.php
_________________
If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button).
Back to top
View user's profile Send private message
DVezina
OOo Advocate
OOo Advocate


Joined: 29 Sep 2006
Posts: 248
Location: Orlando

PostPosted: Sun May 06, 2012 10:48 am    Post subject: Reply with quote

If you haven't already installed xray, I would do that because its the easiest way to see the methods, properties and services allowed for each object. See first sticky post in this forum.

After that, the AndrewMacro document if very helpful. It is written primarily for Word but you can use a lot of it for Impress.

For your immediate problem:

ParaAdjust property on the textcursor controls text alignment.
0 = left
1 = right
2 = justified
3 = center

Code:
Set body=Slide.getbyindex(1)'the first shape is the body
Set BodyText=body.getText()'this bit is like talking to writer
Set Cursor=BodyText.createTextCursor()
Cursor.ParaAdjust=2
Cursor.ParaIsHyphenation=True
Call BodyText.insertString(Cursor,"Outline Item 1 Now is the time for all good men to come to the aid of their father land in this time of dire need. Now is the time.",False)
Cursor.GoToEnd(False)
Call BodyText.insertString(Cursor,Chr(10),False)
Cursor.ParaAdjust=3
Cursor.ParaIsHyphenation=False
Call BodyText.insertString(Cursor,"Outline Item 1 Now is the time for all good men to come to the aid of their father land in this time of dire need. Now is the time.",False)
Back to top
View user's profile Send private message
zizi
General User
General User


Joined: 04 May 2012
Posts: 14

PostPosted: Thu May 10, 2012 3:02 am    Post subject: Reply with quote

Many thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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