NanoXLSX.Core 3.0.0-rc.3
Loading...
Searching...
No Matches
Cell.cs
1/*
2 * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way
3 * Copyright Raphael Stoeckli © 2025
4 * This library is licensed under the MIT License.
5 * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT
6 */
7
8using System;
9using System.Collections.Generic;
10using System.Globalization;
11using System.Text;
12using System.Text.RegularExpressions;
14using NanoXLSX.Styles;
15using NanoXLSX.Utils;
17
18namespace NanoXLSX
19{
23 public class Cell : IComparable<Cell>
24 {
25 #region constants
26 private const int ASCII_OFFSET = 64;
27 #endregion
28
29
30 #region enums
34 public enum CellType
35 {
37#pragma warning disable CA1720 // Suppress warning: Identifier contains type name
39#pragma warning restore CA1720
54 }
55
70
83
84 #endregion
85
86 #region privateFileds
87 private Style cellStyle;
88 private int columnNumber;
89 private int rowNumber;
90 private object value;
91 #endregion
92
93 #region properties
94
98 public string CellAddress
99 {
101 set
102 {
103 AddressType addressType;
104 ResolveCellCoordinate(value, out columnNumber, out rowNumber, out addressType);
105 CellAddressType = addressType;
106 }
107 }
108
111 {
112 get { return new Address(ColumnNumber, RowNumber, CellAddressType); }
113 set
114 {
115 ColumnNumber = value.Column;
116 RowNumber = value.Row;
117 CellAddressType = value.Type;
118 }
119 }
120
125 {
126 get { return cellStyle; }
127 }
128
131 public int ColumnNumber
132 {
133 get { return columnNumber; }
134 set
135 {
137 columnNumber = value;
138 }
139 }
140
142 public CellType DataType { get; set; }
143
144
147 public int RowNumber
148 {
149 get { return rowNumber; }
150 set
151 {
152 ValidateRowNumber(value);
153 rowNumber = value;
154 }
155 }
156
161 public AddressType CellAddressType { get; set; }
162
164 public object Value
165 {
166 get => this.value;
167 set
168 {
169 this.value = value;
171 }
172
173 }
174
175 #endregion
176
177 #region constructors
179 public Cell()
180 {
181 DataType = CellType.Default;
182 }
183
190 public Cell(object value, CellType type)
191 {
192 if (type == CellType.Empty)
193 {
194 this.value = null;
195 }
196 else
197 {
198 this.value = value;
199 }
200 DataType = type;
201 if (type == CellType.Default)
202 {
204 }
205 }
206
214 public Cell(object value, CellType type, string address)
215 {
216 if (type == CellType.Empty)
217 {
218 this.value = null;
219 }
220 else
221 {
222 this.value = value;
223 }
224 DataType = type;
225 CellAddress = address;
226 if (type == CellType.Default)
227 {
229 }
230 }
231
239 public Cell(object value, CellType type, Address address)
240 {
241 if (type == CellType.Empty)
242 {
243 this.value = null;
244 }
245 else
246 {
247 this.value = value;
248 }
249 DataType = type;
250 columnNumber = address.Column;
251 rowNumber = address.Row;
252 CellAddressType = address.Type;
253 if (type == CellType.Default)
254 {
256 }
257 }
258
266 public Cell(object value, CellType type, int column, int row) : this(value, type)
267 {
268 ColumnNumber = column;
269 RowNumber = row;
271 if (type == CellType.Default)
272 {
273 ResolveCellType();
274 }
275 }
276 #endregion
277
278 #region methods
287 public int CompareTo(Cell other)
288 {
289 if (other == null)
290 {
291 return -1;
292 }
293 if (RowNumber == other.RowNumber)
294 {
295 return ColumnNumber.CompareTo(other.ColumnNumber);
296 }
297
298 return RowNumber.CompareTo(other.RowNumber);
299 }
300
306 public override bool Equals(object obj)
307 {
308 if (obj == null || obj.GetType() != typeof(Cell))
309 {
310 return false;
311 }
312 Cell other = (Cell)obj;
313 if (!this.CellAddress2.Equals(other.CellAddress2))
314 {
315 return false;
316 }
317 if (this.cellStyle != null && other.CellStyle != null && !this.CellStyle.Equals(other.CellStyle))
318 {
319 return false;
320 }
321 if (this.DataType != other.DataType)
322 {
323 return false;
324 }
325 if (this.Value != null && other.Value != null && !this.Value.Equals(other.Value))
326 {
327 return false;
328 }
329 return true;
330 }
331
335 public void RemoveStyle()
336 {
337 cellStyle = null;
338 }
339
344 public void ResolveCellType()
345 {
346 if (this.value == null)
347 {
348 DataType = CellType.Empty;
349 this.value = null;
350 return;
351 }
352 if (DataType == CellType.Formula)
353 { return; }
354 Type t = this.value.GetType();
355 if (t == typeof(bool))
356 { DataType = CellType.Bool; }
357 else if (t == typeof(byte) || t == typeof(sbyte))
358 { DataType = CellType.Number; }
359 else if (t == typeof(decimal))
360 { DataType = CellType.Number; }
361 else if (t == typeof(double))
362 { DataType = CellType.Number; }
363 else if (t == typeof(float))
364 { DataType = CellType.Number; }
365 else if (t == typeof(int) || t == typeof(uint))
366 { DataType = CellType.Number; }
367 else if (t == typeof(long) || t == typeof(ulong))
368 { DataType = CellType.Number; }
369 else if (t == typeof(short) || t == typeof(ushort))
370 { DataType = CellType.Number; }
371 else if (t == typeof(DateTime)) // Not native but standard
372 {
373 DataType = CellType.Date;
375 }
376
377 else if (t == typeof(TimeSpan)) // Not native but standard
378 {
379 DataType = CellType.Time;
381 }
382 else { DataType = CellType.String; } // Default (char, string, object)
383 }
384
392 public void SetCellLockedState(bool isLocked, bool isHidden)
393 {
394 Style lockStyle;
395 if (cellStyle == null)
396 {
397 lockStyle = new Style();
398 }
399 else
400 {
401 lockStyle = cellStyle.CopyStyle();
402 }
403 lockStyle.CurrentCellXf.Locked = isLocked;
404 lockStyle.CurrentCellXf.Hidden = isHidden;
405 SetStyle(lockStyle);
406 }
407
414 public Style SetStyle(Style style, bool unmanaged = false)
415 {
416 if (style == null)
417 {
418 throw new StyleException("No style to assign was defined");
419 }
420 cellStyle = unmanaged ? style : StyleRepository.Instance.AddStyle(style);
421 return cellStyle;
422 }
423
428 internal Cell Copy()
429 {
430 Cell copy = new Cell
431 {
432 value = this.value,
433 DataType = this.DataType,
434 CellAddress = this.CellAddress,
435 CellAddressType = this.CellAddressType
436 };
437 if (this.cellStyle != null)
438 {
439 copy.SetStyle(this.cellStyle, true);
440 }
441 return copy;
442 }
447 public override int GetHashCode()
448 {
449 unchecked
450 {
451 int hash = 17;
452 hash = hash * 31 + columnNumber.GetHashCode();
453 hash = hash * 31 + rowNumber.GetHashCode();
454 hash = hash * 31 + CellAddressType.GetHashCode();
455 hash = hash * 31 + DataType.GetHashCode();
456 hash = hash * 31 + (cellStyle?.GetHashCode() ?? 0);
457 hash = hash * 31 + (value?.GetHashCode() ?? 0);
458 return hash;
459 }
460 }
461
468 public static bool operator ==(Cell left, Cell right)
469 {
470 if (ReferenceEquals(left, null))
471 {
472 return ReferenceEquals(right, null);
473 }
474
475 return left.Equals(right);
476 }
477
484 public static bool operator !=(Cell left, Cell right)
485 {
486 return !(left == right);
487 }
488
498 public static bool operator <(Cell left, Cell right)
499 {
500 return ReferenceEquals(left, null) ? !ReferenceEquals(right, null) : left.CompareTo(right) < 0;
501 }
502
512 public static bool operator <=(Cell left, Cell right)
513 {
514 return ReferenceEquals(left, null) || left.CompareTo(right) <= 0;
515 }
516
526 public static bool operator >(Cell left, Cell right)
527 {
528 return !ReferenceEquals(left, null) && left.CompareTo(right) > 0;
529 }
530
540 public static bool operator >=(Cell left, Cell right)
541 {
542 return ReferenceEquals(left, null) ? ReferenceEquals(right, null) : left.CompareTo(right) >= 0;
543 }
544
545 #endregion
546
547 #region staticMethods
554 public static IEnumerable<Cell> ConvertArray<T>(IEnumerable<T> list)
555 {
556 List<Cell> output = new List<Cell>();
557 if (list == null)
558 {
559 return output;
560 }
561 Cell c;
562 object o;
563 Type t;
564 foreach (T item in list)
565 {
566 if (item == null) // DO NOT LISTEN to code suggestions! This is wrong for bool: if (object.Equals(item, default(T)))
567 {
568 c = new Cell(null, CellType.Empty);
569 output.Add(c);
570 continue;
571 }
572 o = item; // intermediate object is necessary to cast the types below
573 t = item.GetType();
574 if (t == typeof(Cell))
575 { c = item as Cell; }
576 else if (t == typeof(bool))
577 { c = new Cell((bool)o, CellType.Bool); }
578 else if (t == typeof(byte))
579 { c = new Cell((byte)o, CellType.Number); }
580 else if (t == typeof(sbyte))
581 { c = new Cell((sbyte)o, CellType.Number); }
582 else if (t == typeof(decimal))
583 { c = new Cell((decimal)o, CellType.Number); }
584 else if (t == typeof(double))
585 { c = new Cell((double)o, CellType.Number); }
586 else if (t == typeof(float))
587 { c = new Cell((float)o, CellType.Number); }
588 else if (t == typeof(int))
589 { c = new Cell((int)o, CellType.Number); }
590 else if (t == typeof(uint))
591 { c = new Cell((uint)o, CellType.Number); }
592 else if (t == typeof(long))
593 { c = new Cell((long)o, CellType.Number); }
594 else if (t == typeof(ulong))
595 { c = new Cell((ulong)o, CellType.Number); }
596 else if (t == typeof(short))
597 { c = new Cell((short)o, CellType.Number); }
598 else if (t == typeof(ushort))
599 { c = new Cell((ushort)o, CellType.Number); }
600 else if (t == typeof(DateTime))
601 {
602 c = new Cell((DateTime)o, CellType.Date);
603 c.SetStyle(BasicStyles.DateFormat);
604 }
605 else if (t == typeof(TimeSpan))
606 {
607 c = new Cell((TimeSpan)o, CellType.Time);
608 c.SetStyle(BasicStyles.TimeFormat);
609 }
610 else if (t == typeof(string))
611 { c = new Cell((string)o, CellType.String); }
612 else // Default = unspecified object
613 {
614 c = new Cell(o.ToString(), CellType.Default);
615 }
616 output.Add(c);
617 }
618 return output;
619 }
620
628 public static IEnumerable<Address> GetCellRange(string range)
629 {
630 Range range2 = ResolveCellRange(range);
631 return GetCellRange(range2.StartAddress, range2.EndAddress);
632 }
633
642 public static IEnumerable<Address> GetCellRange(string startAddress, string endAddress)
643 {
644 Address start = ResolveCellCoordinate(startAddress);
645 Address end = ResolveCellCoordinate(endAddress);
646 return GetCellRange(start, end);
647 }
648
658 public static IEnumerable<Address> GetCellRange(int startColumn, int startRow, int endColumn, int endRow)
659 {
660 Address start = new Address(startColumn, startRow);
661 Address end = new Address(endColumn, endRow);
662 return GetCellRange(start, end);
663 }
664
673 public static IEnumerable<Address> GetCellRange(Address startAddress, Address endAddress)
674 {
675 int startColumn;
676 int endColumn;
677 int startRow;
678 int endRow;
679 if (startAddress.Column < endAddress.Column)
680 {
681 startColumn = startAddress.Column;
682 endColumn = endAddress.Column;
683 }
684 else
685 {
686 startColumn = endAddress.Column;
687 endColumn = startAddress.Column;
688 }
689 if (startAddress.Row < endAddress.Row)
690 {
691 startRow = startAddress.Row;
692 endRow = endAddress.Row;
693 }
694 else
695 {
696 startRow = endAddress.Row;
697 endRow = startAddress.Row;
698 }
699 List<Address> output = new List<Address>();
700 for (int column = startColumn; column <= endColumn; column++)
701 {
702 for (int row = startRow; row <= endRow; row++)
703 {
704 output.Add(new Address(column, row));
705 }
706 }
707 return output;
708 }
709
718 public static string ResolveCellAddress(int column, int row, AddressType type = AddressType.Default)
719 {
720 ValidateColumnNumber(column);
722 switch (type)
723 {
724 case AddressType.FixedRowAndColumn:
725 return "$" + ResolveColumnAddress(column) + "$" + (row + 1);
726 case AddressType.FixedColumn:
727 return "$" + ResolveColumnAddress(column) + (row + 1);
728 case AddressType.FixedRow:
729 return ResolveColumnAddress(column) + "$" + (row + 1);
730 default:
731 return ResolveColumnAddress(column) + (row + 1);
732 }
733 }
734
742 public static Address ResolveCellCoordinate(string address)
743 {
744 int row;
745 int column;
746 AddressType type;
747 ResolveCellCoordinate(address, out column, out row, out type);
748 return new Address(column, row, type);
749 }
750
759 public static void ResolveCellCoordinate(string address, out int column, out int row)
760 {
761 ResolveCellCoordinate(address, out column, out row, out _);
762 }
763
764
774 public static void ResolveCellCoordinate(string address, out int column, out int row, out AddressType addressType)
775 {
776 if (string.IsNullOrEmpty(address))
777 {
778 throw new FormatException("The cell address is null or empty and could not be resolved");
779 }
780 address = ParserUtils.ToUpper(address);
781 Regex pattern = new Regex("(^(\\$?)([A-Z]{1,3})(\\$?)([0-9]{1,7})$)");
782 Match matcher = pattern.Match(address);
783 if (matcher.Groups.Count != 6)
784 {
785 throw new FormatException("The format of the cell address (" + address + ") is malformed");
786 }
787 int digits = int.Parse(matcher.Groups[5].Value, CultureInfo.InvariantCulture);
788 column = ResolveColumn(matcher.Groups[3].Value);
789 row = digits - 1;
791 if (!String.IsNullOrEmpty(matcher.Groups[2].Value) && !String.IsNullOrEmpty(matcher.Groups[4].Value))
792 {
793 addressType = AddressType.FixedRowAndColumn;
794 }
795 else if (!String.IsNullOrEmpty(matcher.Groups[2].Value) && String.IsNullOrEmpty(matcher.Groups[4].Value))
796 {
797 addressType = AddressType.FixedColumn;
798 }
799 else if (String.IsNullOrEmpty(matcher.Groups[2].Value) && !String.IsNullOrEmpty(matcher.Groups[4].Value))
800 {
801 addressType = AddressType.FixedRow;
802 }
803 else
804 {
805 addressType = AddressType.Default;
806 }
807 }
808
816 public static Range ResolveCellRange(string range)
817 {
818 if (string.IsNullOrEmpty(range))
819 {
820 throw new FormatException("The cell range is null or empty and could not be resolved");
821 }
822 if (!range.Contains(":"))
823 {
824 return new Range(ResolveCellCoordinate(range), ResolveCellCoordinate(range));
825 }
826 string[] split = range.Split(':');
827 if (split.Length != 2)
828 {
829 throw new FormatException("The cell range (" + range + ") is malformed and could not be resolved");
830 }
831 return new Range(ResolveCellCoordinate(split[0]), ResolveCellCoordinate(split[1]));
832 }
833
840 public static int ResolveColumn(string columnAddress)
841 {
842 if (String.IsNullOrEmpty(columnAddress))
843 {
844 throw new RangeException("The passed address was null or empty");
845 }
846 columnAddress = ParserUtils.ToUpper(columnAddress);
847 int chr;
848 int result = 0;
849 int multiplier = 1;
850 for (int i = columnAddress.Length - 1; i >= 0; i--)
851 {
852 chr = columnAddress[i];
853 chr -= ASCII_OFFSET;
854 result += (chr * multiplier);
855 multiplier *= 26;
856 }
857 ValidateColumnNumber(result - 1);
858 return result - 1;
859 }
860
867 public static string ResolveColumnAddress(int columnNumber)
868 {
869 ValidateColumnNumber(columnNumber);
870 // A - XFD
871 StringBuilder sb = new StringBuilder();
872 columnNumber++;
873 while (columnNumber > 0)
874 {
875 columnNumber--;
876 sb.Insert(0, (char)('A' + (columnNumber % 26)));
877 columnNumber /= 26;
878 }
879 return sb.ToString();
880 }
881
887 public static AddressScope GetAddressScope(string addressExpression)
888 {
889 try
890 {
891 ResolveCellCoordinate(addressExpression);
892 return AddressScope.SingleAddress;
893 }
894 catch
895 {
896 try
897 {
898 ResolveCellRange(addressExpression);
899 return AddressScope.Range;
900 }
901 catch
902 {
903 return AddressScope.Invalid;
904 }
905 }
906
907 }
908
914 public static void ValidateColumnNumber(int column)
915 {
916 if (column > Worksheet.MaxColumnNumber || column < Worksheet.MinColumnNumber)
917 {
918 throw new RangeException("The column number (" + column + ") is out of range. Range is from " +
919 Worksheet.MinColumnNumber + " to " + Worksheet.MaxColumnNumber + " (" + (Worksheet.MaxColumnNumber + 1) + " columns).");
920 }
921 }
922
928 public static void ValidateRowNumber(int row)
929 {
930 if (row > Worksheet.MaxRowNumber || row < Worksheet.MinRowNumber)
931 {
932 throw new RangeException("The row number (" + row + ") is out of range. Range is from " +
933 Worksheet.MinRowNumber + " to " + Worksheet.MaxRowNumber + " (" + (Worksheet.MaxRowNumber + 1) + " rows).");
934 }
935 }
936 #endregion
937
938 }
939}
Class representing a cell of a worksheet.
Definition Cell.cs:24
static Address ResolveCellCoordinate(string address)
Gets the column and row number (zero based) of a cell by the address.
Definition Cell.cs:742
static bool operator==(Cell left, Cell right)
Determines whether two Cell instances are equal.
Definition Cell.cs:468
override int GetHashCode()
Gets the hash code of the cell.
Definition Cell.cs:447
static IEnumerable< Address > GetCellRange(Address startAddress, Address endAddress)
Get a list of cell addresses from a cell range.
Definition Cell.cs:673
static IEnumerable< Address > GetCellRange(int startColumn, int startRow, int endColumn, int endRow)
Get a list of cell addresses from a cell range.
Definition Cell.cs:658
CellType
Enum defines the basic data types of a cell.
Definition Cell.cs:35
@ String
Type for single characters and strings.
Definition Cell.cs:38
@ Formula
Type for Formulas (The cell will be handled differently).
Definition Cell.cs:49
@ Date
Type for dates (Note: Dates before 1900-01-01 and after 9999-12-31 are not allowed).
Definition Cell.cs:43
@ Default
Default Type, not specified.
Definition Cell.cs:53
@ Time
Type for times (Note: Internally handled as OAdate, represented by TimeSpan).
Definition Cell.cs:45
@ Number
Type for all numeric types (long, integer, float, double, short, byte and decimal; signed and unsigne...
Definition Cell.cs:41
@ Bool
Type for boolean.
Definition Cell.cs:47
@ Empty
Type for empty cells. This type is only used for merged cells (all cells except the first of the cell...
Definition Cell.cs:51
Cell()
Default constructor. Cells created with this constructor do not have a link to a worksheet initially.
Definition Cell.cs:179
static IEnumerable< Cell > ConvertArray< T >(IEnumerable< T > list)
Converts a List of supported objects into a list of cells.
Definition Cell.cs:554
void SetCellLockedState(bool isLocked, bool isHidden)
Sets the lock state of the cell.
Definition Cell.cs:392
static void ValidateRowNumber(int row)
Validates the passed (zero-based) row number. An exception will be thrown if the row is invalid.
Definition Cell.cs:928
Address CellAddress2
Gets or sets the combined cell Address as Address object.
Definition Cell.cs:111
static string ResolveCellAddress(int column, int row, AddressType type=AddressType.Default)
Gets the address of a cell by the column and row number (zero based).
Definition Cell.cs:718
static AddressScope GetAddressScope(string addressExpression)
Gets the scope of the passed address (string expression). Scope means either single cell address or r...
Definition Cell.cs:887
static bool operator<(Cell left, Cell right)
Determines whether the first instance of a Cell is less/smaller as the second.
Definition Cell.cs:498
AddressType
Enum for the referencing style of the address.
Definition Cell.cs:60
@ FixedColumn
Column of the address is fixed (e.g. '$C3').
Definition Cell.cs:66
@ FixedRow
Row of the address is fixed (e.g. 'C$3').
Definition Cell.cs:64
@ FixedRowAndColumn
Row and column of the address is fixed (e.g. '$C$3').
Definition Cell.cs:68
Style CellStyle
Gets the assigned style of the cell.
Definition Cell.cs:125
static bool operator>=(Cell left, Cell right)
Determines whether the first instance of a Cell is greater/larger or equal as the second.
Definition Cell.cs:540
static IEnumerable< Address > GetCellRange(string startAddress, string endAddress)
Get a list of cell addresses from a cell range.
Definition Cell.cs:642
static Range ResolveCellRange(string range)
Resolves a cell range from the format like A1:B3 or AAD556:AAD1000.
Definition Cell.cs:816
int RowNumber
Gets or sets the number of the row (zero-based).
Definition Cell.cs:148
static void ValidateColumnNumber(int column)
Validates the passed (zero-based) column number. An exception will be thrown if the column is invalid...
Definition Cell.cs:914
static int ResolveColumn(string columnAddress)
Gets the column number from the column address (A - XFD).
Definition Cell.cs:840
CellType DataType
Gets or sets the type of the cell.
Definition Cell.cs:142
static bool operator!=(Cell left, Cell right)
Determines whether two Cell instances are not equal.
Definition Cell.cs:484
override bool Equals(object obj)
Compares two objects whether they are addresses and equal.
Definition Cell.cs:306
string CellAddress
Gets or sets the combined cell Address as string in the format A1 - XFD1048576. The address may conta...
Definition Cell.cs:99
Cell(object value, CellType type, string address)
Constructor with value, cell type and address as string. The worksheet reference is set to null and m...
Definition Cell.cs:214
AddressScope
Enum to define the scope of a passed address string (used in static context).
Definition Cell.cs:75
@ SingleAddress
The address represents a single cell.
Definition Cell.cs:77
@ Invalid
The address expression is invalid.
Definition Cell.cs:81
@ Range
The address represents a range of cells.
Definition Cell.cs:79
static void ResolveCellCoordinate(string address, out int column, out int row, out AddressType addressType)
Gets the column and row number (zero based) of a cell by the address.
Definition Cell.cs:774
Cell(object value, CellType type, Address address)
Constructor with value, cell type and address as struct. The worksheet reference is set to null and m...
Definition Cell.cs:239
int ColumnNumber
Gets or sets the number of the column (zero-based).
Definition Cell.cs:132
Cell(object value, CellType type, int column, int row)
Constructor with value, cell type, row number and column number.
Definition Cell.cs:266
Cell(object value, CellType type)
Constructor with value and cell type. Cells created with this constructor do not have a link to a wor...
Definition Cell.cs:190
Style SetStyle(Style style, bool unmanaged=false)
Sets the style of the cell.
Definition Cell.cs:414
static IEnumerable< Address > GetCellRange(string range)
Gets a list of cell addresses from a cell range (format A1:B3 or AAD556:AAD1000).
Definition Cell.cs:628
void ResolveCellType()
Method resets the Cell type and tries to find the actual type. This is used if a Cell was created wit...
Definition Cell.cs:344
AddressType CellAddressType
Gets or sets the optional address type that can be part of the cell address.
Definition Cell.cs:161
static bool operator>(Cell left, Cell right)
Determines whether the first instance of a Cell is greater/larger as the second.
Definition Cell.cs:526
static void ResolveCellCoordinate(string address, out int column, out int row)
Gets the column and row number (zero based) of a cell by the address.
Definition Cell.cs:759
object Value
Gets or sets the value of the cell (generic object type). When setting a value, the DataType is autom...
Definition Cell.cs:165
static string ResolveColumnAddress(int columnNumber)
Gets the column address (A - XFD).
Definition Cell.cs:867
static bool operator<=(Cell left, Cell right)
Determines whether the first instance of a Cell is less/smaller or equal as the second.
Definition Cell.cs:512
int CompareTo(Cell other)
Implemented CompareTo method.
Definition Cell.cs:287
void RemoveStyle()
Removes the assigned style from the cell.
Definition Cell.cs:335
Class for exceptions regarding format error incidents.
Class for exceptions regarding range incidents (e.g. out-of-range).
Class for exceptions regarding Style incidents.
bool Equals(AbstractStyle other)
Method to compare two objects for sorting purpose.
Factory class with the most important predefined styles.
static Style TimeFormat
Gets the time format style.
static Style DateFormat
Gets the date format style.
Class to manage all styles at runtime, before writing XLSX files. The main purpose is deduplication a...
static StyleRepository Instance
Gets the singleton instance of the repository.
Style AddStyle(Style style)
Adds a style to the repository and returns the actual reference.
Class representing a Style with sub classes within a style sheet. An instance of this class is only a...
Definition Style.cs:18
Style CopyStyle()
Method to copy the current object to a new one with casting.
Definition Style.cs:227
Class providing static methods to parse string values to specific types or to print object as languag...
static string ToUpper(string input)
Transforms a string to upper case with null check and invariant culture.
Class representing a worksheet of a workbook.
Definition Worksheet.cs:26
static readonly int MinColumnNumber
Minimum column number (zero-based) as constant.
Definition Worksheet.cs:53
static readonly int MaxRowNumber
Maximum row number (zero-based) as constant.
Definition Worksheet.cs:74
static readonly int MaxColumnNumber
Maximum column number (zero-based) as constant.
Definition Worksheet.cs:48
static readonly int MinRowNumber
Minimum row number (zero-based) as constant.
Definition Worksheet.cs:79
Struct representing the cell address as column and row (zero based).
Definition Address.cs:16
int Row
Row number (zero based).
Definition Address.cs:28
Cell.AddressType Type
Referencing type of the address.
Definition Address.cs:33
bool Equals(Address other)
Compares two addresses whether they are equal.
Definition Address.cs:112
int Column
Column number (zero based).
Definition Address.cs:24
Struct representing a cell range with a start and end address.
Definition Range.cs:16
Address StartAddress
Start address of the range.
Definition Range.cs:27
Address EndAddress
End address of the range.
Definition Range.cs:23