Aracılığıyla paylaş


ApplicationFactory.HasVstoObject Yöntem (ListObject)

Gösteren bir değeri döndürür olup bir Microsoft.Office.Tools.Excel.ListObject var için belirtilen yerel listesi nesnesi.

Ad alanı:  Microsoft.Office.Tools.Excel
Derleme:  Microsoft.Office.Tools.Excel (Microsoft.Office.Tools.Excel.dll içinde)

Sözdizimi

'Bildirim
Function HasVstoObject ( _
    listObject As ListObject _
) As Boolean
bool HasVstoObject(
    ListObject listObject
)

Parametreler

Dönüş Değeri

Tür: System.Boolean
true yoksa bir Microsoft.Office.Tools.Excel.ListObject var belirtilen için Microsoft.Office.Interop.Excel.ListObject nesne; Aksi takdirde, false.

Örnekler

Aşağıdaki kod örneği, her yerel listesi nesnesini ilişkili ana öğe listesi nesnesi varsa, belirlemek için çalışma sayfasındaki denetler. Çalıştır buradan bu kodu kullanmak için ThisAddIn bir Excel eklentisini sınıfında hedefleyen proje .NET Framework 4.

Dim mySheet As Excel.Worksheet = Me.Application.ActiveSheet
If mySheet.ListObjects.Count > 0 Then
    For Each list As Excel.ListObject In mySheet.ListObjects
        If Globals.Factory.HasVstoObject(list) = True Then
            System.Windows.Forms.MessageBox.Show( _
                "The VSTO properties of list objects are not " _
                + "persisted when you save and close this workbook.", _
                "VSTO ListObject", _
                System.Windows.Forms.MessageBoxButtons.OK, _
                System.Windows.Forms.MessageBoxIcon.Warning)
            Exit For
        End If
    Next
End If
Excel.Worksheet mySheet = (Excel.Worksheet)
    this.Application.Worksheets["Sheet1"];
if (mySheet.ListObjects.Count > 0)
{
    foreach (Excel.ListObject list in mySheet.ListObjects)
    {
        if (Globals.Factory.HasVstoObject(list) == true)
        {
            System.Windows.Forms.MessageBox.Show(
                "The VSTO properties of list objects are not "
                + "persisted when you save and close this workbook.",
                "VSTO ListObject",
                System.Windows.Forms.MessageBoxButtons.OK,
                System.Windows.Forms.MessageBoxIcon.Warning);
            break;
        }
    }
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

ApplicationFactory Arabirim

HasVstoObject Fazla Yük

Microsoft.Office.Tools.Excel Ad Alanı