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

VB, sWriter and PARAGRAPH_BREAK: need Help

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


Joined: 22 Aug 2004
Posts: 6

PostPosted: Wed Aug 25, 2004 4:19 am    Post subject: VB, sWriter and PARAGRAPH_BREAK: need Help Reply with quote

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
View user's profile Send private message Send e-mail
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Wed Aug 25, 2004 6:15 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Wed Aug 25, 2004 10:56 am    Post subject: Reply with quote

See :
A tutorial for Programming OpenOffice.org with Visual Basic
http://www.oooforum.org/forum/viewtopic.php?t=11854&highlight=

or ask to the author.
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
Danad
OOo Advocate
OOo Advocate


Joined: 22 Feb 2004
Posts: 293
Location: Brasil

PostPosted: Wed Aug 25, 2004 11:45 am    Post subject: Reply with quote

I think DannyB already answered this question.

Do a search for "PARAGRAPH_BREAK".
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


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

PostPosted: Thu Aug 26, 2004 8:36 am    Post subject: Reply with quote

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
View user's profile Send private message
Sireloup
General User
General User


Joined: 22 Aug 2004
Posts: 6

PostPosted: Thu Aug 26, 2004 9:00 am    Post subject: Many Thanks Reply with quote

Exactly what I did after reading the SDK documentation. It works perfectly.
Thank you very much
Back to top
View user's profile Send private message Send e-mail
Danad
OOo Advocate
OOo Advocate


Joined: 22 Feb 2004
Posts: 293
Location: Brasil

PostPosted: Sun Jan 02, 2005 5:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sergey Redko
Newbie
Newbie


Joined: 21 Jan 2005
Posts: 1

PostPosted: Fri Jan 21, 2005 7:41 am    Post subject: Reply with quote

Your code to access enum values work good in LotusScript (VB dialect)
Thank you for your post Wink
Back to top
View user's profile Send private message
Aringarosa
Newbie
Newbie


Joined: 13 Jul 2011
Posts: 3

PostPosted: Thu Jul 14, 2011 8:33 am    Post subject: Reply with quote

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
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