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

Joined: 24 Nov 2008 Posts: 45
|
Posted: Thu May 07, 2009 8:10 pm Post subject: [Solved] Placing text in a named section of a document |
|
|
Hi all,
I am bringing text in from a dialog and want to place it in a named section in a document. I'm not sure if the following tack is the right one:
| Code: | Dim oDoc as Object
Dim oSections as Object
Dim oSec as Object
oDoc = thiscomponent
oSections = oDoc.getTextSections
oSec = oSections.GetByName("Instructions")
oSec.Text = "Hello" '<-- Fails |
Notably, the last line fails, since there is no ".Text" attribute of a section. Anyone have any ideas?
Thanks. _________________ --Steve
Last edited by slang4201 on Fri May 08, 2009 6:31 am; edited 1 time in total |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3152 Location: Columbus, Ohio, USA
|
|
| Back to top |
|
 |
slang4201 General User

Joined: 24 Nov 2008 Posts: 45
|
Posted: Fri May 08, 2009 6:30 am Post subject: |
|
|
I missed one small part, this now works:
| Code: | Dim oDoc as Object
Dim oSections as Object
Dim oSec as Object
oDoc = thisComponent
oSections = oDoc.getTextSections
oSec = oSections.GetByName("Instructions")
oSec.Anchor.String = "Hello" |
Thanks for the pointer to Anchor! _________________ --Steve |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3152 Location: Columbus, Ohio, USA
|
|
| Back to top |
|
 |
slang4201 General User

Joined: 24 Nov 2008 Posts: 45
|
Posted: Fri May 08, 2009 1:14 pm Post subject: |
|
|
It does indeed. I haven't tested it with text already in the section to see if it replaces what is already there, though I suspect it does. _________________ --Steve |
|
| Back to top |
|
 |
|