Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") Dim doc As New PrintDoc '定义一个报表 For Each nd As WinForm.TreeNode In trv.AllNodes Dim rt As New prt.RenderText '定义一个文本对象 rt.Text = "".PadLeft(nd.Level * 8) & nd.Text doc.Body.Children.Add(rt) '将文本对象加入到报表 Next doc.Preview() '预览