XmlMappedRange.BorderAround Method (2007 System)
Adds a border to an XmlMappedRange control and sets the Color, LineStyle, and Weight properties for the new border.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
Public Function BorderAround ( _
LineStyle As Object, _
Weight As XlBorderWeight, _
ColorIndex As XlColorIndex, _
Color As Object _
) As Object
'Usage
Dim instance As XmlMappedRange
Dim LineStyle As Object
Dim Weight As XlBorderWeight
Dim ColorIndex As XlColorIndex
Dim Color As Object
Dim returnValue As Object
returnValue = instance.BorderAround(LineStyle, _
Weight, ColorIndex, Color)
public Object BorderAround(
Object LineStyle,
XlBorderWeight Weight,
XlColorIndex ColorIndex,
Object Color
)
public:
Object^ BorderAround(
Object^ LineStyle,
XlBorderWeight Weight,
XlColorIndex ColorIndex,
Object^ Color
)
public function BorderAround(
LineStyle : Object,
Weight : XlBorderWeight,
ColorIndex : XlColorIndex,
Color : Object
) : Object
Parameters
LineStyle
Type: System.ObjectThe line style for the border. Can be one of the following XlLineStyle values:
Weight
Type: XlBorderWeightThe border weight. Can be one of the following XlBorderWeight constants:
ColorIndex
Type: XlColorIndexThe border color, as an index into the current color palette or as an XlColorIndex constant. Can be one of the following XlColorIndex constants:
Color
Type: System.ObjectThe border color, as an RGB value.
Return Value
Type: System.Object
Remarks
You must specify either ColorIndex or Color, but not both.
You can specify either LineStyle or Weight, but not both. If you do not specify either argument, Microsoft Office Excel uses the default line style and weight.
This method outlines the XmlMappedRange control without filling it in.
To clear the border, you can set the LineStyle property to xlLineStyleNone for the XmlMappedRange control.
Optional Parameters
For information on optional parameters, see The Variable missing and Optional Parameters in Office Solutions.
Examples
The following code example uses the BorderAround method to apply a thick border around an XmlMappedRange. The example then prompts the user to clear the border by using the ClearFormats method. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.
Private Sub SetBorder()
Me.CustomerLastNameCell.BorderAround( _
Weight:=Excel.XlBorderWeight.xlThick, _
ColorIndex:=Excel.XlColorIndex.xlColorIndexAutomatic)
If MessageBox.Show("Clear the border?", "Test", MessageBoxButtons.YesNo) = _
DialogResult.Yes Then
Me.CustomerLastNameCell.ClearFormats()
End If
End Sub
private void SetBorder()
{
this.CustomerLastNameCell.BorderAround(missing,
Excel.XlBorderWeight.xlThick,
Excel.XlColorIndex.xlColorIndexAutomatic, missing);
if (MessageBox.Show("Clear the border?", "Test",
MessageBoxButtons.YesNo) == DialogResult.Yes)
{
this.CustomerLastNameCell.ClearFormats();
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.