NamedRange.AutoFormat Yöntem
Biçimleri otomatik olarak NamedRange , önceden tanımlanmış bir biçimi kullanarak denetlemek.
Ad alanı: Microsoft.Office.Tools.Excel
Derleme: Microsoft.Office.Tools.Excel (Microsoft.Office.Tools.Excel.dll içinde)
Sözdizimi
'Bildirim
Function AutoFormat ( _
Format As XlRangeAutoFormat, _
Number As Object, _
Font As Object, _
Alignment As Object, _
Border As Object, _
Pattern As Object, _
Width As Object _
) As Object
Object AutoFormat(
XlRangeAutoFormat Format,
Object Number,
Object Font,
Object Alignment,
Object Border,
Object Pattern,
Object Width
)
Parametreler
- Format
Tür: Microsoft.Office.Interop.Excel.XlRangeAutoFormat
Aşağıdakilerden biri olabilir XlRangeAutoFormat sabitler:
xlRangeAutoFormat3DEffects1
xlRangeAutoFormat3DEffects2
xlRangeAutoFormatAccounting1
xlRangeAutoFormatAccounting2
xlRangeAutoFormatAccounting3
xlRangeAutoFormatAccounting4
xlRangeAutoFormatClassic1
xlRangeAutoFormatClassic2
xlRangeAutoFormatClassic3
xlRangeAutoFormatClassicPivotTable
xlRangeAutoFormatColor1
xlRangeAutoFormatColor2
xlRangeAutoFormatColor3
xlRangeAutoFormatList1
xlRangeAutoFormatList2
xlRangeAutoFormatList3
xlRangeAutoFormatLocalFormat1
xlRangeAutoFormatLocalFormat2
xlRangeAutoFormatLocalFormat3
xlRangeAutoFormatLocalFormat4
xlRangeAutoFormatNone
xlRangeAutoFormatPTNone
xlRangeAutoFormatReport1
xlRangeAutoFormatReport10
xlRangeAutoFormatReport2
xlRangeAutoFormatReport3
xlRangeAutoFormatReport4
xlRangeAutoFormatReport5
xlRangeAutoFormatReport6
xlRangeAutoFormatReport7
xlRangeAutoFormatReport8
xlRangeAutoFormatReport9
xlRangeAutoFormatSimple
xlRangeAutoFormatTable1
xlRangeAutoFormatTable10
xlRangeAutoFormatTable2
xlRangeAutoFormatTable3
xlRangeAutoFormatTable4
xlRangeAutoFormatTable5
xlRangeAutoFormatTable6
xlRangeAutoFormatTable7
xlRangeAutoFormatTable8
xlRangeAutoFormatTable9
Varsayılan sabit xlRangeAutoFormatClassic1.
Bu sabitlerin bazıları bağlı olarak dil desteği için kullanılabilir olmayabilir (u.s. , örneğin İngilizce), seçili veya yüklü.
- Number
Tür: System.Object
true sayı biçimleri otomatik biçim eklemek için.Varsayılan değertrue.
- Font
Tür: System.Object
true yazı tipi eklemek için otomatik biçimlendirir. true varsayılan değerdir.
- Alignment
Tür: System.Object
true Hizalama otomatik biçim eklemek için. true varsayılan değerdir.
- Border
Tür: System.Object
true Kenarlık eklemek için otomatik biçimlendirir. true varsayılan değerdir.
- Pattern
Tür: System.Object
true Desen eklemek için otomatik biçimlendirir. true varsayılan değerdir.
- Width
Tür: System.Object
true Sütun genişliğini ve satır yüksekliğini otomatik biçim eklemek için. true varsayılan değerdir.
Dönüş Değeri
Tür: System.Object
Notlar
Tek bir hücre aralığı, bu yöntem de etkin hücrenin çevresindeki bölgenin biçimlendirir.
İsteğe bağlı parametreler
İsteğe bağlı parametreler hakkında daha fazla bilgi için bkz: Office Çözümlerinde İsteğe Bağlı Parametreler.
Örnekler
Aşağıdaki kod örneğinde, çeşitli biçimlendirme ve özelliklerini görüntülemek gösterilmiştir bir NamedRange adında bir denetimi NamedRange1.Özellikle, bu örnek kullanır AutoFormat biçimlendirmek için yöntem NamedRange1 kullanarak xlRangeAutoFormat3DEffects1 biçimi.
Bu örnek için belge düzeyi özelleştirmesinde içindir.
Private Sub SetRangeFormats()
Dim namedRange1 As Microsoft.Office.Tools.Excel.NamedRange _
= Me.Controls.AddNamedRange(Me.Range("A1", "A5"), _
"namedRange1")
namedRange1.NoteText("This is a Formatting test", , )
namedRange1.Value2 = "Martha"
namedRange1.Font.Name = "Verdana"
namedRange1.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter
namedRange1.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter
namedRange1.BorderAround(, Excel.XlBorderWeight.xlThick, _
Excel.XlColorIndex.xlColorIndexAutomatic, )
namedRange1.AutoFormat( _
Excel.XlRangeAutoFormat.xlRangeAutoFormat3DEffects1, _
True, False, True, False, True, True)
If MessageBox.Show("Clear the formatting and notes?", _
"Test", MessageBoxButtons.YesNo) = DialogResult.Yes Then
namedRange1.ClearFormats()
namedRange1.ClearNotes()
End If
End Sub
private void SetRangeFormats()
{
Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
this.Controls.AddNamedRange(this.Range["A1", "A5"],
"namedRange1");
namedRange1.NoteText("This is a Formatting test");
namedRange1.Value2 = "Martha";
namedRange1.Font.Name = "Verdana";
namedRange1.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;
namedRange1.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
namedRange1.BorderAround(missing, Excel.XlBorderWeight.xlThick,
Excel.XlColorIndex.xlColorIndexAutomatic);
namedRange1.AutoFormat(Excel.XlRangeAutoFormat.xlRangeAutoFormat3DEffects1,
true, false, true, false, true, true);
if (MessageBox.Show("Clear the formatting and notes?", "Test",
MessageBoxButtons.YesNo) == DialogResult.Yes)
{
namedRange1.ClearFormats();
namedRange1.ClearNotes();
}
}
.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üvenilen kod kitaplıklarını kullanma.