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

Changing string format (font weight, etc.)

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Cosmic P
OOo Enthusiast
OOo Enthusiast


Joined: 23 Mar 2005
Posts: 186

PostPosted: Wed Apr 20, 2005 2:36 am    Post subject: Changing string format (font weight, etc.) Reply with quote

Can I change the properties of a text?
Can I also do this for the contents of a user field?
Back to top
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3622
Location: Columbus, Ohio, USA

PostPosted: Wed Apr 20, 2005 6:56 am    Post subject: Reply with quote

Read Setting Text Attributes in my free macro document.
_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Wed Apr 20, 2005 7:28 am    Post subject: Reply with quote

See this example.....

Altering CharacterProperties of Text
http://www.oooforum.org/forum/viewtopic.php?t=6195

One subroutine is used to change the color and Bold of some text. But the subroutine is called to manipulate a Text on three different document types: Calc, Writer and Draw. This shows that you can use the same type of code to manipulate the attributes of Text in any kind of document.

See Also....

Writer Examples
http://www.oooforum.org/forum/viewtopic.php?t=6049
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Cosmic P
OOo Enthusiast
OOo Enthusiast


Joined: 23 Mar 2005
Posts: 186

PostPosted: Wed Apr 20, 2005 9:58 pm    Post subject: Reply with quote

Well I tried a few things, but what I actually wanted to do, seems impossible.

I'm making a few multi languange templates for the office. The user can choose between English, German and French. All the information is put into arrays and will be inserted automatically.

The texts will be put into user fields like this:

line1 & Chr(13) & line2 & Chr(13) & line3

All should be formatted differently. Therefor I'd like to format the variables before there put into the user field, but this seems impossible because CharHeight(), CharColor(), etc. only apply to object type variables, and not to string type variables.

Possibly I could put some routine together to select the text with a TextCursor() by using the functions Mid() and Len(), but isn't there an easier way?

Or would it be possible to simply select all the contents of a user field?
Back to top
View user's profile Send private message
Ernst Lustig
General User
General User


Joined: 06 Apr 2005
Posts: 29
Location: Stuttgart, Germany

PostPosted: Thu Apr 21, 2005 3:38 am    Post subject: Reply with quote

Sounds amazing, but it is obviously not possible to pass along the formatting properties together with the content.
But since you must know the content and where to put the content, it should be easy to select the content immediately after inserting and apply formatting.
Back to top
View user's profile Send private message
Cosmic P
OOo Enthusiast
OOo Enthusiast


Joined: 23 Mar 2005
Posts: 186

PostPosted: Sun Apr 24, 2005 11:36 am    Post subject: Reply with quote

I somehow can not create a text cursor within a user field. No matter what I try, nothing works here: "object variable not set", "variable already defined differently", "invalid use of method", "property or method not found", ...

Any help?
Back to top
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3622
Location: Columbus, Ohio, USA

PostPosted: Tue Apr 26, 2005 9:09 am    Post subject: Reply with quote

Quote:
I somehow can not create a text cursor within a user field

You are correct, you can not do this. You might consider using bookmarks instead, and then insert the text content at the bookmark.
_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
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