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

Help Regarding OpenOffice and VB

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


Joined: 26 Nov 2007
Posts: 6
Location: India

PostPosted: Tue Nov 27, 2007 12:42 am    Post subject: Help Regarding OpenOffice and VB Reply with quote

Hi All,

First of all... thanks a ton for the code snippets posted by lot of you guys!!! It really helped me create a calc file and manipulate the cells of the file. THNKS A TON!!!

I am facing a problem now.... I hv the code that would write in a cell, change cell color etc. The task ahead of me is how do I draw borders to the cell?

Tried creating a function as under :

Function MakeCellBorderLine(nColor, nInnerLineWidth, nOuterLineWidth, nLineDistance) As com.sun.star.Table.BorderLine
oBorderLine = createUnoStruct("com.sun.star.table.BorderLine")
With oBorderLine
.Color = nColor
.innerlinewidth = nInnerLineWidth
.outerlinewidth = nOuterLineWidth
.linedistance = nLineDistance
End With

MakeCellBorderLine = oBorderLine
End Function


The above function would NEVER BE possible without the snippets posted on this forum. Anyways...... when I run my application it gives me the following error :
"User-defined type not defined"

Can someone tell me what do I need to do and where am I going wrong????

Thanks a ton once again......... take care guys !!

Rgds,
SAM
Back to top
View user's profile Send private message Yahoo Messenger
Mark B
Super User
Super User


Joined: 16 Feb 2007
Posts: 852
Location: Lincolnshire, UK

PostPosted: Tue Nov 27, 2007 2:13 am    Post subject: Reply with quote

Hi Sam,

This seems to be one of areas where the api doesn't work exactly as you'd expect, I've found that the only way to change the borders is by making use of the setPropertyValues method:
Code:

oCell=thisComponent.Sheets(0).getCellRangeByName("C9")
oCell.setPropertyValues( Array( "TopBorder"),_
      Array( Array( RGB(255,0,0),100, 200, 300))

oCell=thisComponent.Sheets(0).getCellRangeByName("C10")
oCell.setPropertyValues( _
      Array( "LeftBorder", "RightBorder",),_
      Array( Array( RGB(255,0,0), 100, 100, 100 ), _
             Array( RGB(0,0,255), 200, 200, 200 ) )

The input variables are color, InnerLineWidth, OuterLineWidth, LineDistance.

Mark
_________________
Mark B's Articles
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
samdotnetprg
General User
General User


Joined: 26 Nov 2007
Posts: 6
Location: India

PostPosted: Tue Nov 27, 2007 2:28 am    Post subject: Hey Mark !! Reply with quote

Hi mark,

Thanks for your reply. Can I ask you a question please?? Would like to know is there any way where in we can use reference of com.sun.star in VB???

What I mean to ask is ... like in VB.NET we say :
imports System.Oledb.Data


In ASP.NET we say : using System.Data.OleDb

Similarly if i want to expose the properties of OpenOffice API's in VB.... whatz the way?? Am just not able to proceed further. The solution that you gave me gives me an error that says : Complie Error : Expected =

Any take on this??

Rgds,
SAM
Back to top
View user's profile Send private message Yahoo Messenger
samdotnetprg
General User
General User


Joined: 26 Nov 2007
Posts: 6
Location: India

PostPosted: Tue Nov 27, 2007 3:05 am    Post subject: hi mark Reply with quote

Posted: Tue Nov 27, 2007 2:28 am Post subject: Hey Mark !!

--------------------------------------------------------------------------------

Hi mark,

Thanks for your reply. Can I ask you a question please?? Would like to know is there any way where in we can use reference of com.sun.star in VB???

What I mean to ask is ... like in VB.NET we say :
imports System.Oledb.Data


In ASP.NET we say : using System.Data.OleDb

Similarly if i want to expose the properties of OpenOffice API's in VB.... whatz the way?? Am just not able to proceed further. The solution that you gave me gives me an error that says : Complie Error : Expected =

Any take on this??

Rgds,
SAM

Mark B wrote:
Hi Sam,

This seems to be one of areas where the api doesn't work exactly as you'd expect, I've found that the only way to change the borders is by making use of the setPropertyValues method:
Code:

oCell=thisComponent.Sheets(0).getCellRangeByName("C9")
oCell.setPropertyValues( Array( "TopBorder"),_
      Array( Array( RGB(255,0,0),100, 200, 300))

oCell=thisComponent.Sheets(0).getCellRangeByName("C10")
oCell.setPropertyValues( _
      Array( "LeftBorder", "RightBorder",),_
      Array( Array( RGB(255,0,0), 100, 100, 100 ), _
             Array( RGB(0,0,255), 200, 200, 200 ) )

The input variables are color, InnerLineWidth, OuterLineWidth, LineDistance.

Mark
Back to top
View user's profile Send private message Yahoo Messenger
vitcaro
OOo Advocate
OOo Advocate


Joined: 20 Feb 2007
Posts: 256
Location: Italy

PostPosted: Wed Nov 28, 2007 10:44 am    Post subject: Reply with quote

In VB6 the code is:

Function MakeCellBorderLine(nColor&, nInnerLineWidth%, nOuterLineWidth%, nLineDistance%) As object
dim oBorderLine as object

set oBorderLine = createUnoStruct("com.sun.star.table.BorderLine")
With oBorderLine
.Color = nColor
.innerlinewidth = nInnerLineWidth
.outerlinewidth = nOuterLineWidth
.linedistance = nLineDistance
End With

set MakeCellBorderLine = oBorderLine
End Function
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