-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.vb
68 lines (60 loc) · 2.24 KB
/
MainWindow.xaml.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
Imports DevExpress.Spreadsheet
Imports DevExpress.Xpf.NavBar
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Namespace SpreadsheetControl_WPF_API
''' <summary>
''' Interaction logic for MainWindow.xaml
''' </summary>
Partial Public Class MainWindow
Inherits DevExpress.Xpf.Core.ThemedWindow
Private workbook As IWorkbook
Public Sub New()
InitializeComponent()
' Access a workbook.
workbook = spreadsheetControl1.Document
DataContext = Groups.InitData()
End Sub
Private Sub NavigationPaneView_MouseDoubleClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
Dim group As NavBarGroup = DirectCast(sender, NavBarViewBase).GetNavBarGroup(e)
Dim item As NavBarItem = DirectCast(sender, NavBarViewBase).GetNavBarItem(e)
If item Is Nothing Then
Return
End If
Dim example As SpreadsheetExample = TryCast(item.Content, SpreadsheetExample)
If example Is Nothing Then
Return
End If
LoadDocumentFromFile()
Dim action As Action(Of IWorkbook) = example.Action
action(workbook)
SaveDocumentToFile()
End Sub
' ------------------- Load and Save a Document -------------------
Private Sub LoadDocumentFromFile()
' #Region "#LoadFromFile"
' Load a workbook from a file.
workbook.LoadDocument("Documents\Document.xlsx", DocumentFormat.OpenXml)
' #End Region ' #LoadFromFile
End Sub
Private Sub SaveDocumentToFile()
' #Region "#SaveToFile"
' Save the modified document to a file.
workbook.SaveDocument("Documents\SavedDocument.xlsx", DocumentFormat.OpenXml)
' #End Region ' #SaveToFile
End Sub
End Class
End Namespace