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

Change a writer document field by macro

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


Joined: 18 May 2011
Posts: 2

PostPosted: Thu Nov 10, 2011 3:06 am    Post subject: Change a writer document field by macro Reply with quote

Hello,

I'm trying to change the field content in a Writer document.
I do know how to read the value using:
Code:

ThisComponent.TextFieldMasters.getByName("com.sun.star.text.FieldMaster.User.mytestfield").DependentTextFields(0).getPresentation(false)

Now to change I've read elsewhere about someone who tried to do something similar, by using:
Code:

field = thisComponent.TextFieldMasters.getByName("com.sun.star.text.FieldMaster.User.mytestfield").DependentTextFields(0)
anchor = field.getAnchor()
anchor.Text.insertString(anchor,"new text", false)

However this only puts a text in front of the field, not replacing the field's content. Is there anyway the content of the field itself can be changed?

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