1 | /*******************************************************************************
|
---|
2 | * You may amend and distribute as you like, but don't remove this header!
|
---|
3 | *
|
---|
4 | * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
|
---|
5 | * See http://www.codeplex.com/EPPlus for details.
|
---|
6 | *
|
---|
7 | * Copyright (C) 2011 Jan Källman
|
---|
8 | *
|
---|
9 | * This library is free software; you can redistribute it and/or
|
---|
10 | * modify it under the terms of the GNU Lesser General Public
|
---|
11 | * License as published by the Free Software Foundation; either
|
---|
12 | * version 2.1 of the License, or (at your option) any later version.
|
---|
13 |
|
---|
14 | * This library is distributed in the hope that it will be useful,
|
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
17 | * See the GNU Lesser General Public License for more details.
|
---|
18 | *
|
---|
19 | * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
|
---|
20 | * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
|
---|
21 | *
|
---|
22 | * All code and executables are provided "as is" with no warranty either express or implied.
|
---|
23 | * The author accepts no liability for any damage or loss of business that this product may cause.
|
---|
24 | *
|
---|
25 | * Code change notes:
|
---|
26 | *
|
---|
27 | * Author Change Date
|
---|
28 | * ******************************************************************************
|
---|
29 | * Jan Källman Initial Release 2011-11-02
|
---|
30 | * Jan Källman License changed GPL-->LGPL 2011-12-27
|
---|
31 | *******************************************************************************/
|
---|
32 | using System;
|
---|
33 | using System.Collections.Generic;
|
---|
34 | using System.Text;
|
---|
35 | using System.Xml;
|
---|
36 | namespace OfficeOpenXml
|
---|
37 | {
|
---|
38 | /// <summary>
|
---|
39 | /// Access to workbook view properties
|
---|
40 | /// </summary>
|
---|
41 | public class ExcelWorkbookView : XmlHelper
|
---|
42 | {
|
---|
43 | #region ExcelWorksheetView Constructor
|
---|
44 | /// <summary>
|
---|
45 | /// Creates a new ExcelWorkbookView which provides access to all the
|
---|
46 | /// view states of the worksheet.
|
---|
47 | /// </summary>
|
---|
48 | /// <param name="ns"></param>
|
---|
49 | /// <param name="node"></param>
|
---|
50 | /// <param name="wb"></param>
|
---|
51 | internal ExcelWorkbookView(XmlNamespaceManager ns, XmlNode node, ExcelWorkbook wb) :
|
---|
52 | base(ns, node)
|
---|
53 | {
|
---|
54 | SchemaNodeOrder = wb.SchemaNodeOrder;
|
---|
55 | }
|
---|
56 | #endregion
|
---|
57 | const string LEFT_PATH="d:bookViews/d:workbookView/@xWindow";
|
---|
58 | /// <summary>
|
---|
59 | /// Position of the upper left corner of the workbook window. In twips.
|
---|
60 | /// </summary>
|
---|
61 | public int Left
|
---|
62 | {
|
---|
63 | get
|
---|
64 | {
|
---|
65 | return GetXmlNodeInt(LEFT_PATH);
|
---|
66 | }
|
---|
67 | internal set
|
---|
68 | {
|
---|
69 | SetXmlNodeString(LEFT_PATH,value.ToString());
|
---|
70 | }
|
---|
71 | }
|
---|
72 | const string TOP_PATH="d:bookViews/d:workbookView/@yWindow";
|
---|
73 | /// <summary>
|
---|
74 | /// Position of the upper left corner of the workbook window. In twips.
|
---|
75 | /// </summary>
|
---|
76 | public int Top
|
---|
77 | {
|
---|
78 | get
|
---|
79 | {
|
---|
80 | return GetXmlNodeInt(TOP_PATH);
|
---|
81 | }
|
---|
82 | internal set
|
---|
83 | {
|
---|
84 | SetXmlNodeString(TOP_PATH, value.ToString());
|
---|
85 | }
|
---|
86 | }
|
---|
87 | const string WIDTH_PATH="d:bookViews/d:workbookView/@windowWidth";
|
---|
88 | /// <summary>
|
---|
89 | /// Width of the workbook window. In twips.
|
---|
90 | /// </summary>
|
---|
91 | public int Width
|
---|
92 | {
|
---|
93 | get
|
---|
94 | {
|
---|
95 | return GetXmlNodeInt(WIDTH_PATH);
|
---|
96 | }
|
---|
97 | internal set
|
---|
98 | {
|
---|
99 | SetXmlNodeString(WIDTH_PATH, value.ToString());
|
---|
100 | }
|
---|
101 | }
|
---|
102 | const string HEIGHT_PATH="d:bookViews/d:workbookView/@windowHeight";
|
---|
103 | /// <summary>
|
---|
104 | /// Height of the workbook window. In twips.
|
---|
105 | /// </summary>
|
---|
106 | public int Height
|
---|
107 | {
|
---|
108 | get
|
---|
109 | {
|
---|
110 | return GetXmlNodeInt(HEIGHT_PATH);
|
---|
111 | }
|
---|
112 | internal set
|
---|
113 | {
|
---|
114 | SetXmlNodeString(HEIGHT_PATH, value.ToString());
|
---|
115 | }
|
---|
116 | }
|
---|
117 | const string MINIMIZED_PATH="d:bookViews/d:workbookView/@minimized";
|
---|
118 | /// <summary>
|
---|
119 | /// If true the the workbook window is minimized.
|
---|
120 | /// </summary>
|
---|
121 | public bool Minimized
|
---|
122 | {
|
---|
123 | get
|
---|
124 | {
|
---|
125 | return GetXmlNodeBool(MINIMIZED_PATH);
|
---|
126 | }
|
---|
127 | set
|
---|
128 | {
|
---|
129 | SetXmlNodeString(MINIMIZED_PATH, value.ToString());
|
---|
130 | }
|
---|
131 | }
|
---|
132 | const string SHOWVERTICALSCROLL_PATH = "d:bookViews/d:workbookView/@showVerticalScroll";
|
---|
133 | /// <summary>
|
---|
134 | /// Show the vertical scrollbar
|
---|
135 | /// </summary>
|
---|
136 | public bool ShowVerticalScrollBar
|
---|
137 | {
|
---|
138 | get
|
---|
139 | {
|
---|
140 | return GetXmlNodeBool(SHOWVERTICALSCROLL_PATH,true);
|
---|
141 | }
|
---|
142 | set
|
---|
143 | {
|
---|
144 | SetXmlNodeBool(SHOWVERTICALSCROLL_PATH, value, true);
|
---|
145 | }
|
---|
146 | }
|
---|
147 | const string SHOWHORIZONTALSCR_PATH = "d:bookViews/d:workbookView/@showHorizontalScroll";
|
---|
148 | /// <summary>
|
---|
149 | /// Show the horizontal scrollbar
|
---|
150 | /// </summary>
|
---|
151 | public bool ShowHorizontalScrollBar
|
---|
152 | {
|
---|
153 | get
|
---|
154 | {
|
---|
155 | return GetXmlNodeBool(SHOWHORIZONTALSCR_PATH, true);
|
---|
156 | }
|
---|
157 | set
|
---|
158 | {
|
---|
159 | SetXmlNodeBool(SHOWHORIZONTALSCR_PATH, value, true);
|
---|
160 | }
|
---|
161 | }
|
---|
162 | const string SHOWSHEETTABS_PATH = "d:bookViews/d:workbookView/@showSheetTabs";
|
---|
163 | /// <summary>
|
---|
164 | /// Show the sheet tabs
|
---|
165 | /// </summary>
|
---|
166 | public bool ShowSheetTabs
|
---|
167 | {
|
---|
168 | get
|
---|
169 | {
|
---|
170 | return GetXmlNodeBool(SHOWSHEETTABS_PATH, true);
|
---|
171 | }
|
---|
172 | set
|
---|
173 | {
|
---|
174 | SetXmlNodeBool(SHOWSHEETTABS_PATH, value, true);
|
---|
175 | }
|
---|
176 | }
|
---|
177 | /// <summary>
|
---|
178 | /// Set the window position in twips
|
---|
179 | /// </summary>
|
---|
180 | /// <param name="left"></param>
|
---|
181 | /// <param name="top"></param>
|
---|
182 | /// <param name="width"></param>
|
---|
183 | /// <param name="height"></param>
|
---|
184 | public void SetWindowSize(int left, int top, int width, int height)
|
---|
185 | {
|
---|
186 | Left = left;
|
---|
187 | Top = top;
|
---|
188 | Width = width;
|
---|
189 | Height = height;
|
---|
190 | }
|
---|
191 | }
|
---|
192 | }
|
---|
193 | |
---|