boom structuur in WORD document

  • Onderwerp starter Onderwerp starter Int
  • Startdatum Startdatum
Status
Niet open voor verdere reacties.

Int

Gebruiker
Lid geworden
3 nov 2006
Berichten
7
ik wil een boom structuur waarvan ik de variabele kan invoegen in het tabel.
Zoals onderstaand voorbeeld. ik wil dan var invoegen in een tabel.

Baas
+ assistent
- var1
+ assistent2
- var2
+ assisten3
+ Groep1
+ Tab1
- var3

Kan dit in VBA in WORD ?


----
ik heb een voorbeeld in VB in .NET 2008

Class Person
Private m_Name As String
Public Property Name() As String
Get
Name = m_Name
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Private m_Father As Person
Public Property Father() As Person
Get
Father = m_Father
End Get
Set(ByVal value As Person)
m_Father = value
End Set
End Property
Private m_Mother As Person
Public Property Mother() As Person
Get
Mother = m_Mother
End Get
Set(ByVal value As Person)
m_Mother = value
End Set
End Property
End Class
Class Example
Public Shared Sub Main()
Dim paul As Person = New Person With {.Name = "Paul"}
Dim elisabeth As Person = New Person With {.Name = "Elisabeth"}
'
Dim john As Person = New Person With {.Name = "John", _
.Mother = elisabeth}
Dim ema As Person = New Person With {.Name = "Ema", _
.Father = paul}
'
Dim george As Person = New Person With {.Name = "George", _
.Father = john, _
.Mother = ema}
'
PrintFamily(george)
'
Console.ReadLine()
End Sub
Public Shared Sub PrintFamily(ByVal person As Person, _
Optional ByVal depth As Integer = 0)
Console.WriteLine(person.Name)
If person.Father IsNot Nothing Then
Console.Write(New String(" "c, depth + 2) & "- father : ")
PrintFamily(person.Father, depth + 2)
End If
If person.Mother IsNot Nothing Then
Console.Write(New String(" "c, depth + 2) & "- mother : ")
PrintFamily(person.Mother, depth + 2)
End If
End Sub
End Class
-----------------------------------------------------------------
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan