NamedRange.ColumnWidth Property (2007 System)
Gets or sets the width of all columns in the NamedRange control.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
<BrowsableAttribute(False)> _
Public Property ColumnWidth As Object
'Usage
Dim instance As NamedRange
Dim value As Object
value = instance.ColumnWidth
instance.ColumnWidth = value
[BrowsableAttribute(false)]
public Object ColumnWidth { get; set; }
[BrowsableAttribute(false)]
public:
property Object^ ColumnWidth {
Object^ get ();
void set (Object^ value);
}
public function get ColumnWidth () : Object
public function set ColumnWidth (value : Object)
Property Value
Type: System.Object
If all columns in the NamedRange control have the same width, this property returns an object that represents the width. If columns in the range have different widths, this property returns nulla null reference (Nothing in Visual Basic).
Remarks
One unit of column width is equal to the width of one character in the Normal style. For proportional fonts, the width of the character 0 (zero) is used.
Use the Width property to return the width of a column in points.
Examples
The following code example creates a NamedRange and then sets the width of the columns and the height of the rows that are part of the range.
This example is for a document-level customization.
Private setColumnRowRange As Microsoft.Office.Tools.Excel.NamedRange
Private Sub SetColumnAndRowSizes()
setColumnRowRange = Me.Controls.AddNamedRange( _
Me.Range("C3", "E6"), "setColumnRowRange")
Me.setColumnRowRange.ColumnWidth = 20
Me.setColumnRowRange.RowHeight = 25
setColumnRowRange.Select()
End Sub
Microsoft.Office.Tools.Excel.NamedRange setColumnRowRange;
private void SetColumnAndRowSizes()
{
setColumnRowRange = this.Controls.AddNamedRange(
this.Range["C3", "E6"], "setColumnRowRange");
this.setColumnRowRange.ColumnWidth = 20;
this.setColumnRowRange.RowHeight = 25;
setColumnRowRange.Select();
}
.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.