Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2435-alglib_3_15/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorkbookView.cs @ 16724

Last change on this file since 16724 was 12074, checked in by sraggl, 10 years ago

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 7.0 KB
Line 
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 *******************************************************************************/
32using System;
33using System.Collections.Generic;
34using System.Globalization;
35using System.Text;
36using System.Xml;
37namespace OfficeOpenXml
38{
39    /// <summary>
40    /// Access to workbook view properties
41    /// </summary>
42    public class ExcelWorkbookView : XmlHelper
43    {
44        #region ExcelWorksheetView Constructor
45        /// <summary>
46        /// Creates a new ExcelWorkbookView which provides access to all the
47        /// view states of the worksheet.
48        /// </summary>
49        /// <param name="ns"></param>
50        /// <param name="node"></param>
51        /// <param name="wb"></param>
52        internal ExcelWorkbookView(XmlNamespaceManager ns, XmlNode node, ExcelWorkbook wb) :
53            base(ns, node)
54    {
55            SchemaNodeOrder = wb.SchemaNodeOrder;
56    }
57    #endregion
58        const string LEFT_PATH="d:bookViews/d:workbookView/@xWindow";
59        /// <summary>
60        /// Position of the upper left corner of the workbook window. In twips.
61        /// </summary>
62        public int Left
63        {
64            get
65            {
66                return GetXmlNodeInt(LEFT_PATH);
67            }
68            internal set
69            {
70                SetXmlNodeString(LEFT_PATH,value.ToString());
71            }
72        }
73        const string TOP_PATH="d:bookViews/d:workbookView/@yWindow";
74        /// <summary>
75        /// Position of the upper left corner of the workbook window. In twips.
76        /// </summary>
77        public int Top
78        {
79            get
80            {
81                return GetXmlNodeInt(TOP_PATH);
82            }
83            internal set
84            {
85                SetXmlNodeString(TOP_PATH, value.ToString());
86            }
87        }
88        const string WIDTH_PATH="d:bookViews/d:workbookView/@windowWidth";
89        /// <summary>
90        /// Width of the workbook window. In twips.
91        /// </summary>
92        public int Width
93        {
94            get
95            {
96                return GetXmlNodeInt(WIDTH_PATH);
97            }
98            internal set
99            {
100                SetXmlNodeString(WIDTH_PATH, value.ToString());
101            }
102        }
103        const string HEIGHT_PATH="d:bookViews/d:workbookView/@windowHeight";
104        /// <summary>
105        /// Height of the workbook window. In twips.
106        /// </summary>
107        public int Height
108        {
109            get
110            {
111                return GetXmlNodeInt(HEIGHT_PATH);
112            }
113            internal set
114            {
115                SetXmlNodeString(HEIGHT_PATH, value.ToString());
116            }
117        }
118        const string MINIMIZED_PATH="d:bookViews/d:workbookView/@minimized";
119        /// <summary>
120        /// If true the the workbook window is minimized.
121        /// </summary>
122        public bool Minimized
123        {
124            get
125            {
126                return GetXmlNodeBool(MINIMIZED_PATH);
127            }
128            set
129            {
130                SetXmlNodeString(MINIMIZED_PATH, value.ToString());
131            }
132        }
133        const string SHOWVERTICALSCROLL_PATH = "d:bookViews/d:workbookView/@showVerticalScroll";
134        /// <summary>
135        /// Show the vertical scrollbar
136        /// </summary>
137        public bool ShowVerticalScrollBar
138        {
139            get
140            {
141                return GetXmlNodeBool(SHOWVERTICALSCROLL_PATH,true);
142            }
143            set
144            {
145                SetXmlNodeBool(SHOWVERTICALSCROLL_PATH, value, true);
146            }
147        }
148        const string SHOWHORIZONTALSCR_PATH = "d:bookViews/d:workbookView/@showHorizontalScroll";
149        /// <summary>
150        /// Show the horizontal scrollbar
151        /// </summary>
152        public bool ShowHorizontalScrollBar
153        {
154            get
155            {
156                return GetXmlNodeBool(SHOWHORIZONTALSCR_PATH, true);
157            }
158            set
159            {
160                SetXmlNodeBool(SHOWHORIZONTALSCR_PATH, value, true);
161            }
162        }
163        const string SHOWSHEETTABS_PATH = "d:bookViews/d:workbookView/@showSheetTabs";
164        /// <summary>
165        /// Show the sheet tabs
166        /// </summary>
167        public bool ShowSheetTabs
168        {
169            get
170            {
171                return GetXmlNodeBool(SHOWSHEETTABS_PATH, true);
172            }
173            set
174            {
175                SetXmlNodeBool(SHOWSHEETTABS_PATH, value, true);
176            }
177        }
178        /// <summary>
179        /// Set the window position in twips
180        /// </summary>
181        /// <param name="left"></param>
182        /// <param name="top"></param>
183        /// <param name="width"></param>
184        /// <param name="height"></param>
185        public void SetWindowSize(int left, int top, int width, int height)
186        {
187            Left = left;
188            Top = top;
189            Width = width;
190            Height = height;
191        }
192
193        const string ACTIVETAB_PATH = "d:bookViews/d:workbookView/@activeTab";
194        public int ActiveTab
195        {
196            get
197            {
198                var v=GetXmlNodeInt(ACTIVETAB_PATH);
199                if (v < 0)
200                    return 0;
201                else
202                    return v;
203
204            }
205            set
206            {
207                SetXmlNodeString(ACTIVETAB_PATH, value.ToString(CultureInfo.InvariantCulture));
208            }
209        }
210    }
211}
212   
Note: See TracBrowser for help on using the repository browser.