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.cs
94 lines (82 loc) · 3.56 KB
/
Form1.cs
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
using System;
using System.Collections;
using System.Windows.Forms;
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
namespace AK16962 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e) {
XtraReport1 r = new XtraReport1();
ReportPrintTool rpt = new ReportPrintTool(r);
rpt.ShowPreviewDialog();
}
private void button2_Click(object sender, EventArgs e) {
XtraReport1 rep = new XtraReport1();
rep.CreateDocument();
ArrayList bookmarklist = new ArrayList();
int i = 0;
while(i < rep.PrintingSystem.Document.BookmarkNodes.Count) {
int index = IsNodeIncluded(bookmarklist, rep.PrintingSystem.Document.BookmarkNodes[i]);
if(index == -1) {
bookmarklist.Add(new BookMarkList(rep.PrintingSystem.Document.BookmarkNodes[i], rep.PrintingSystem.Document.BookmarkNodes[i].Page.Index, rep.PrintingSystem.Document.BookmarkNodes[i].Text));
}
else {
if(((BookMarkList)(bookmarklist[index])).Page > rep.PrintingSystem.Document.BookmarkNodes[i].Page.Index) {
((BookMarkList)(bookmarklist[index])).Node = rep.PrintingSystem.Document.BookmarkNodes[i];
((BookMarkList)(bookmarklist[index])).Page = rep.PrintingSystem.Document.BookmarkNodes[i].Page.Index;
((BookMarkList)(bookmarklist[index])).Name = rep.PrintingSystem.Document.BookmarkNodes[i].Text;
}
}
i += 1;
}
i = 0;
while(i < rep.PrintingSystem.Document.BookmarkNodes.Count) {
int index = IsNodeIncluded(bookmarklist, rep.PrintingSystem.Document.BookmarkNodes[i]);
if(((BookMarkList)(bookmarklist[index])).Node == rep.PrintingSystem.Document.BookmarkNodes[i]) {
}
else {
int j = 0;
while(j < rep.PrintingSystem.Document.BookmarkNodes[i].Nodes.Count) {
((BookMarkList)(bookmarklist[index])).Node.Nodes.Add(rep.PrintingSystem.Document.BookmarkNodes[i].Nodes[j]);
j += 1;
}
rep.PrintingSystem.Document.BookmarkNodes[i].Nodes.Clear();
rep.PrintingSystem.Document.BookmarkNodes.RemoveAt(i);
i = i - 1;
}
i += 1;
}
rep.ShowPreviewDialog();
}
private int IsNodeIncluded(ArrayList bookmarklist, BookmarkNode bookmarkNode)
{
foreach (BookMarkList item in bookmarklist)
{
if (item.Name == bookmarkNode.Text)
{
return bookmarklist.IndexOf(item);
}
}
return -1;
}
}
public class BookMarkList {
private BookmarkNode node_Renamed;
public BookmarkNode Node { get { return node_Renamed;} set {node_Renamed = value; }
}
private int page_Renamed;
public int Page {get {return page_Renamed;} set { page_Renamed = value; }
}
private string name_Renamed;
public string Name { get { return name_Renamed; } set { name_Renamed = value; }
}
public BookMarkList(BookmarkNode node_Renamed, int page_Renamed, string name_Renamed) {
this.node_Renamed = node_Renamed;
this.page_Renamed = page_Renamed;
this.name_Renamed = name_Renamed;
}
}
}