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


Joined: 22 Aug 2004 Posts: 6
|
Posted: Wed Aug 25, 2004 4:19 am Post subject: VB, sWriter and PARAGRAPH_BREAK: need Help |
|
|
I spent my weekend on the forum to try to understand How I can Automate sWriter with VB. I found a lot of wonderfully precious material but I still can'f figure out How to use insertControlCharacter in VB: I can't access the constant com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK.
can someone help me? |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Wed Aug 25, 2004 6:15 am Post subject: |
|
|
Mhhh, a good question.
Have you looked into CoreReflection to reflect a type.
However I don't think this would work for constants, but usually you should still be able to assign the represantive integer of the constant enumeration.
For the PARAGRAPH_BREAK constant the number you have to assign would be 0.
If this will not work I will have a look at that with Python.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
Danad OOo Advocate

Joined: 22 Feb 2004 Posts: 293 Location: Brasil
|
Posted: Wed Aug 25, 2004 11:45 am Post subject: |
|
|
I think DannyB already answered this question.
Do a search for "PARAGRAPH_BREAK". |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Thu Aug 26, 2004 8:36 am Post subject: |
|
|
My belief is that in VB you cannot access the constant or enums by name. (I would love to be proven wrong on this. Please, anyone.)
Therefore, rather than code the symbol name into your code, simply hardcode the constant value itself.
The com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK has a value of zero. So simply hardcode a zero into your program instead of the constant name.
If you really want things to be clear, create some kind of constant in VB so that your intent is perfectly clear. I don't know VB, so I'm just making up the following, but something like this....
Const com_sun_star_text_ControlCharacter_PARAGRAPH_BREAK = 0; _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
Sireloup General User


Joined: 22 Aug 2004 Posts: 6
|
Posted: Thu Aug 26, 2004 9:00 am Post subject: Many Thanks |
|
|
Exactly what I did after reading the SDK documentation. It works perfectly.
Thank you very much |
|
| Back to top |
|
 |
Danad OOo Advocate

Joined: 22 Feb 2004 Posts: 293 Location: Brasil
|
Posted: Sun Jan 02, 2005 5:44 pm Post subject: |
|
|
I don't work with VB, so I haven't tested this code to access enum values:
| Code: |
Sub enumValue
' OK for OOo Basic
oCR = createUnoService("com.sun.star.reflection.CoreReflection")
oIdlCampos = oCR.forName("com.sun.star.text.PageNumberType")
aCampos = oIdlCampos.getFields()
For i=LBound(aCampos) To Ubound(aCampos)
oField = aCampos(i)
Print oField.Name; " - "; oField.get(Null)
Next i
End Sub
|
|
|
| Back to top |
|
 |
Sergey Redko Newbie

Joined: 21 Jan 2005 Posts: 1
|
Posted: Fri Jan 21, 2005 7:41 am Post subject: |
|
|
Your code to access enum values work good in LotusScript (VB dialect)
Thank you for your post  |
|
| Back to top |
|
 |
Aringarosa Newbie

Joined: 13 Jul 2011 Posts: 3
|
Posted: Thu Jul 14, 2011 8:33 am Post subject: |
|
|
| Danad wrote: | I don't work with VB, so I haven't tested this code to access enum values:
| Code: |
Sub enumValue
' OK for OOo Basic
oCR = createUnoService("com.sun.star.reflection.CoreReflection")
oIdlCampos = oCR.forName("com.sun.star.text.PageNumberType")
aCampos = oIdlCampos.getFields()
For i=LBound(aCampos) To Ubound(aCampos)
oField = aCampos(i)
Print oField.Name; " - "; oField.get(Null)
Next i
End Sub
|
|
Your code so good, it worked. Thank you!
|
|
| Back to top |
|
 |
|