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

Joined: 26 Nov 2007 Posts: 6 Location: India
|
Posted: Tue Nov 27, 2007 12:42 am Post subject: Help Regarding OpenOffice and VB |
|
|
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 |
|
 |
Mark B Super User


Joined: 16 Feb 2007 Posts: 852 Location: Lincolnshire, UK
|
Posted: Tue Nov 27, 2007 2:13 am Post subject: |
|
|
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 |
|
 |
samdotnetprg General User

Joined: 26 Nov 2007 Posts: 6 Location: India
|
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 |
|
| Back to top |
|
 |
samdotnetprg General User

Joined: 26 Nov 2007 Posts: 6 Location: India
|
Posted: Tue Nov 27, 2007 3:05 am Post subject: hi mark |
|
|
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 |
|
 |
vitcaro OOo Advocate


Joined: 20 Feb 2007 Posts: 256 Location: Italy
|
Posted: Wed Nov 28, 2007 10:44 am Post subject: |
|
|
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 |
|
 |
|
|
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
|