NamedRange.Rows Özellik
Alır bir Microsoft.Office.Interop.Excel.Range temsil eden bir veya daha fazla satır NamedRange Denetim.
Ad alanı: Microsoft.Office.Tools.Excel
Derleme: Microsoft.Office.Tools.Excel (Microsoft.Office.Tools.Excel.dll içinde)
Sözdizimi
'Bildirim
ReadOnly Property Rows As Range
Get
Range Rows { get; }
Özellik Değeri
Tür: Microsoft.Office.Interop.Excel.Range
A Microsoft.Office.Interop.Excel.Range temsil eden bir veya daha fazla satır NamedRange Denetim.
Açıklamalar
Parametresiz kullanıldığında, bu özellik döndürür bir Range nesne içeren tüm satırları adlandırılmış bir aralığı.
Bu özellik aşağıdaki isteğe bağlı parametreler ile adlandırılmış aralık içinde belirli satırları almak için kullanılabilir. Bu özellik parametreleriyle kullanırsanız, dönüş değeri için dönüştürmelisiniz bir nesnedir bir Range.
Parametre |
Açyklama |
---|---|
RowIndex |
Almak için bir veya daha fazla satır dizini. Tek bir satır almak için almak istediğiniz satırın dizini belirten bir tamsayı geçmesi. 1 Satır dizinler başlar. Bitişik birden çok satır almak için bir dize biçiminde geçmesi "first row:last row". Örneğin, satır 1, 5'ten almak için "1: 5" geçmesi. |
ColumnIndex |
Bu parametreyi kullanmayın. Bu özellik yaratacak bir COMException , çalışmadan geçmesi bir değer bu parametre. |
Örnekler
Aşağıdaki kod örneği oluşturur bir NamedRange ve sonra Rows renk, adı, boyutu ve ilk beş satır aralık tüm hücrelerin yazı boldness ayarlama özelliği
Bu örnek, bir belge düzeyinde özelleştirme için bulunur. Bu kod çalıştırmak için projenizde çalışma sınıflarından içine kopyalayın.
Private Sub SetRowsFont()
Dim testRange As Microsoft.Office.Tools.Excel.NamedRange = _
Me.Controls.AddNamedRange(Me.Range("A1", "J10"), _
"TestRange")
testRange.Select()
Dim fillRows As Excel.Range = TryCast(testRange.Rows("1:5"), Excel.Range)
With fillRows.Font
' Set the font color to blue (RGB value 00 00 FF), and set other font properties.
.Color = &HFF0000
.Name = "Arial"
.Size = 14
.Bold = False
End With
' Test the changes by writing a value to all the row cells.
fillRows.Value2 = "This is a test"
End Sub
private void SetRowsFont()
{
Microsoft.Office.Tools.Excel.NamedRange testRange =
this.Controls.AddNamedRange(this.Range["A1", "J10"],
"TestRange");
testRange.Select();
Excel.Range fillRows = (Excel.Range)testRange.Rows["1:5", missing];
Excel.Font rowsFont = fillRows.Font;
// Set the font color to blue (RGB value 00 00 FF), and set other font properties.
rowsFont.Color = 0xFF0000;
rowsFont.Name = "Arial";
rowsFont.Size = 14;
rowsFont.Bold = false;
// Test the changes by writing a value to all the row cells.
fillRows.Value2 = "This is a test";
}
Aşağıdaki kod örneği oluşturur bir NamedRange ve sonra Rows özellik belirleme kaç satır vardır aralığı.
Bu örnek, bir belge düzeyinde özelleştirme için bulunur. Bu kod çalıştırmak için projenizde çalışma sınıflarından içine kopyalayın.
Private compositeRange As Microsoft.Office.Tools.Excel.NamedRange
Private Sub DisplayRangeComposition()
compositeRange = Me.Controls.AddNamedRange( _
Me.Range("B2", "E5"), "compositeRange")
compositeRange.Cells.Interior.Color = &HFF00
MessageBox.Show("The range has " & _
compositeRange.Count & " cells.")
MessageBox.Show("The range has " & _
compositeRange.Columns.Count & " columns.")
MessageBox.Show("The range has " & _
compositeRange.Rows.Count & " rows.")
End Sub
Microsoft.Office.Tools.Excel.NamedRange compositeRange;
private void DisplayRangeComposition()
{
compositeRange = this.Controls.AddNamedRange(
this.Range["B2", "E5"], "compositeRange");
compositeRange.Cells.Interior.Color = 0xFF00;
MessageBox.Show("The range has " + compositeRange.Count +
" cells.");
MessageBox.Show("The range has " +
compositeRange.Columns.Count + " columns.");
MessageBox.Show("The range has " +
compositeRange.Rows.Count + " rows.");
}
.NET Framework Güvenliği
- Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. kısmen güvenilir kod tarafından Kitaplıklar kullanma.