Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2213_irace/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelTextFormat.cs @ 16854

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

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 5.3 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-01-01
30 * Jan Källman        License changed GPL-->LGPL 2011-12-27
31 *******************************************************************************/
32using System;
33using System.Collections.Generic;
34using System.Text;
35using System.Globalization;
36
37namespace OfficeOpenXml
38{
39    /// <summary>
40    /// Discribes a column when reading a text using the ExcelRangeBase.LoadFromText method
41    /// </summary>
42    public enum eDataTypes
43    {
44        /// <summary>
45        /// Let the the import decide.
46        /// </summary>
47        Unknown,
48        /// <summary>
49        /// Always a string.
50        /// </summary>
51        String,
52        /// <summary>
53        /// Try to convert it to a number. If it fails then add it as a string.
54        /// </summary>
55        Number,
56        /// <summary>
57        /// Try to convert it to a date. If it fails then add it as a string.
58        /// </summary>
59        DateTime,
60        /// <summary>
61        /// Try to convert it to a number and divide with 100.
62        /// Removes any tailing percent sign (%). If it fails then add it as a string.
63        /// </summary>
64        Percent
65    }
66    /// <summary>
67    /// Describes how to split a CSV text. Used by the ExcelRange.LoadFromText method
68    /// </summary>
69    public class ExcelTextFormat
70    {
71        /// <summary>
72        /// Describes how to split a CSV text
73        ///
74        /// Default values
75        /// <list>
76        /// <listheader><term>Property</term><description>Value</description></listheader>
77        /// <item><term>Delimiter</term><description>,</description></item>
78        /// <item><term>TextQualifier</term><description>None (\0)</description></item>
79        /// <item><term>EOL</term><description>CRLF</description></item>
80        /// <item><term>Culture</term><description>CultureInfo.InvariantCulture</description></item>
81        /// <item><term>DataTypes</term><description>End of line default CRLF</description></item>
82        /// <item><term>SkipLinesBeginning</term><description>0</description></item>
83        /// <item><term>SkipLinesEnd</term><description>0</description></item>
84        /// <item><term>Encoding</term><description>Encoding.ASCII</description></item>
85        /// </list>
86        /// </summary>
87        public ExcelTextFormat()
88        {
89            Delimiter = ',';
90            TextQualifier = '\0';
91            EOL = "\r\n";
92            Culture = CultureInfo.InvariantCulture;
93            DataTypes=null;
94            SkipLinesBeginning = 0;
95            SkipLinesEnd = 0;
96            Encoding=Encoding.ASCII;
97        }
98        /// <summary>
99        /// Delimiter character
100        /// </summary>
101        public char Delimiter { get; set; }
102        /// <summary>
103        /// Text qualifier character
104        /// </summary>
105        public char TextQualifier {get; set; }
106        /// <summary>
107        /// End of line characters. Default CRLF
108        /// </summary>
109        public string EOL { get; set; }
110        /// <summary>
111        /// Datatypes list for each column (if column is not present Unknown is assumed)
112        /// </summary>
113        public eDataTypes[] DataTypes { get; set; }
114        /// <summary>
115        /// Culture used when parsing. Default CultureInfo.InvariantCulture
116        /// </summary>
117        public CultureInfo Culture {get; set; }
118        /// <summary>
119        /// Number of lines skiped in the begining of the file. Default 0.
120        /// </summary>
121        public int SkipLinesBeginning { get; set; }
122        /// <summary>
123        /// Number of lines skiped at the end of the file. Default 0.
124        /// </summary>
125        public int SkipLinesEnd { get; set; }
126        /// <summary>
127        /// Only used when reading files from disk using a FileInfo object. Default AscII
128        /// </summary>
129        public Encoding Encoding { get; set; }
130    }
131}
Note: See TracBrowser for help on using the repository browser.