This repository has been archived by the owner on Jun 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.vb
109 lines (96 loc) · 3.41 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Imports System
Imports System.Collections
Imports System.Windows.Forms
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraReports.UI
Namespace AK16962
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
Dim r As New XtraReport1()
Dim rpt As New ReportPrintTool(r)
rpt.ShowPreviewDialog()
End Sub
Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button2.Click
Dim rep As New XtraReport1()
rep.CreateDocument()
Dim bookmarklist As New ArrayList()
Dim i As Integer = 0
Do While i < rep.PrintingSystem.Document.BookmarkNodes.Count
Dim index As Integer = IsNodeIncluded(bookmarklist, rep.PrintingSystem.Document.BookmarkNodes(i))
If index = -1 Then
bookmarklist.Add(New BookMarkList(rep.PrintingSystem.Document.BookmarkNodes(i), rep.PrintingSystem.Document.BookmarkNodes(i).PageIndex, rep.PrintingSystem.Document.BookmarkNodes(i).Text))
Else
If DirectCast(bookmarklist(index), BookMarkList).Page > rep.PrintingSystem.Document.BookmarkNodes(i).PageIndex Then
DirectCast(bookmarklist(index), BookMarkList).Node = rep.PrintingSystem.Document.BookmarkNodes(i)
DirectCast(bookmarklist(index), BookMarkList).Page = rep.PrintingSystem.Document.BookmarkNodes(i).PageIndex
DirectCast(bookmarklist(index), BookMarkList).Name = rep.PrintingSystem.Document.BookmarkNodes(i).Text
End If
End If
i += 1
Loop
i = 0
Do While i < rep.PrintingSystem.Document.BookmarkNodes.Count
Dim index As Integer = IsNodeIncluded(bookmarklist, rep.PrintingSystem.Document.BookmarkNodes(i))
If DirectCast(bookmarklist(index), BookMarkList).Node Is rep.PrintingSystem.Document.BookmarkNodes(i) Then
Else
Dim j As Integer = 0
Do While j < rep.PrintingSystem.Document.BookmarkNodes(i).Nodes.Count
DirectCast(bookmarklist(index), BookMarkList).Node.Nodes.Add(rep.PrintingSystem.Document.BookmarkNodes(i).Nodes(j))
j += 1
Loop
rep.PrintingSystem.Document.BookmarkNodes(i).Nodes.Clear()
rep.PrintingSystem.Document.BookmarkNodes.RemoveAt(i)
i = i - 1
End If
i += 1
Loop
rep.ShowPreviewDialog()
End Sub
Private Function IsNodeIncluded(ByVal bookmarklist As ArrayList, ByVal bookmarkNode As BookmarkNode) As Integer
For Each item As BookMarkList In bookmarklist
If item.Name = bookmarkNode.Text Then
Return bookmarklist.IndexOf(item)
End If
Next item
Return -1
End Function
End Class
Public Class BookMarkList
Private node_Renamed As BookmarkNode
Public Property Node() As BookmarkNode
Get
Return node_Renamed
End Get
Set(ByVal value As BookmarkNode)
node_Renamed = value
End Set
End Property
Private page_Renamed As Integer
Public Property Page() As Integer
Get
Return page_Renamed
End Get
Set(ByVal value As Integer)
page_Renamed = value
End Set
End Property
Private name_Renamed As String
Public Property Name() As String
Get
Return name_Renamed
End Get
Set(ByVal value As String)
name_Renamed = value
End Set
End Property
Public Sub New(ByVal node_Renamed As BookmarkNode, ByVal page_Renamed As Integer, ByVal name_Renamed As String)
Me.node_Renamed = node_Renamed
Me.page_Renamed = page_Renamed
Me.name_Renamed = name_Renamed
End Sub
End Class
End Namespace