NanoXLSX.Core 3.1.0
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 © 2026
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;
13using NanoXLSX.Styles;
14using NanoXLSX.Utils;
16
17namespace NanoXLSX
18{
22 public class Cell : IComparable<Cell>
23 {
24 #region constants
25 private const int ASCII_OFFSET = 64;
26 #endregion
27
28 #region enums
32 public enum CellType
33 {
35#pragma warning disable CA1720 // Suppress warning: Identifier contains type name
37#pragma warning restore CA1720
52 }
53
68
81
82 #endregion
83
84 #region privateFileds
85 private Style cellStyle;
86 private int columnNumber;
87 private int rowNumber;
88 private object value;
89 #endregion
90
91 #region properties
92
96 public string CellAddress
97 {
99 set
100 {
101 AddressType addressType;
102 ResolveCellCoordinate(value, out columnNumber, out rowNumber, out addressType);
103 CellAddressType = addressType;
104 }
105 }
106
109 {
110 get { return new Address(ColumnNumber, RowNumber, CellAddressType); }
111 set
112 {
113 ColumnNumber = value.Column;
114 RowNumber = value.Row;
115 CellAddressType = value.Type;
116 }
117 }
118
123 {
124 get { return cellStyle; }
125 }
126
129 public int ColumnNumber
130 {
131 get { return columnNumber; }
132 set
133 {
135 columnNumber = value;
136 }
137 }
138
140 public CellType DataType { get; set; }
141
142
145 public int RowNumber
146 {
147 get { return rowNumber; }
148 set
149 {
150 ValidateRowNumber(value);
151 rowNumber = value;
152 }
153 }
154
159 public AddressType CellAddressType { get; set; }
160
162 public object Value
163 {
164 get => this.value;
165 set
166 {
167 this.value = value;
169 }
170
171 }
172
173 #endregion
174
175 #region constructors
177 public Cell()
178 {
179 DataType = CellType.Default;
180 }
181
188 public Cell(object value, CellType type)
189 {
190 if (type == CellType.Empty)
191 {
192 this.value = null;
193 }
194 else
195 {
196 this.value = value;
197 }
198 DataType = type;
199 if (type == CellType.Default)
200 {
202 }
203 }
204
212 public Cell(object value, CellType type, string address)
213 {
214 if (type == CellType.Empty)
215 {
216 this.value = null;
217 }
218 else
219 {
220 this.value = value;
221 }
222 DataType = type;
223 CellAddress = address;
224 if (type == CellType.Default)
225 {
227 }
228 }
229
237 public Cell(object value, CellType type, Address address)
238 {
239 if (type == CellType.Empty)
240 {
241 this.value = null;
242 }
243 else
244 {
245 this.value = value;
246 }
247 DataType = type;
248 columnNumber = address.Column;
249 rowNumber = address.Row;
250 CellAddressType = address.Type;
251 if (type == CellType.Default)
252 {
254 }
255 }
256
264 public Cell(object value, CellType type, int column, int row) : this(value, type)
265 {
266 ColumnNumber = column;
267 RowNumber = row;
269 if (type == CellType.Default)
270 {
271 ResolveCellType();
272 }
273 }
274 #endregion
275
276 #region methods
285 public int CompareTo(Cell other)
286 {
287 if (other == null)
288 {
289 return -1;
290 }
291 if (RowNumber == other.RowNumber)
292 {
293 return ColumnNumber.CompareTo(other.ColumnNumber);
294 }
295
296 return RowNumber.CompareTo(other.RowNumber);
297 }
298
304 public override bool Equals(object obj)
305 {
306 if (obj == null || obj.GetType() != typeof(Cell))
307 {
308 return false;
309 }
310 Cell other = (Cell)obj;
311 if (!this.CellAddress2.Equals(other.CellAddress2))
312 {
313 return false;
314 }
315 if (this.cellStyle != null && other.CellStyle != null && !this.CellStyle.Equals(other.CellStyle))
316 {
317 return false;
318 }
319 if (this.DataType != other.DataType)
320 {
321 return false;
322 }
323 if (this.Value != null && other.Value != null && !this.Value.Equals(other.Value))
324 {
325 return false;
326 }
327 return true;
328 }
329
333 public void RemoveStyle()
334 {
335 cellStyle = null;
336 }
337
342 public void ResolveCellType()
343 {
344 if (this.value == null)
345 {
346 DataType = CellType.Empty;
347 this.value = null;
348 return;
349 }
350 if (DataType == CellType.Formula)
351 { return; }
352 Type t = this.value.GetType();
353 if (t == typeof(bool))
354 { DataType = CellType.Bool; }
355 else if (t == typeof(byte) || t == typeof(sbyte))
356 { DataType = CellType.Number; }
357 else if (t == typeof(decimal))
358 { DataType = CellType.Number; }
359 else if (t == typeof(double))
360 { DataType = CellType.Number; }
361 else if (t == typeof(float))
362 { DataType = CellType.Number; }
363 else if (t == typeof(int) || t == typeof(uint))
364 { DataType = CellType.Number; }
365 else if (t == typeof(long) || t == typeof(ulong))
366 { DataType = CellType.Number; }
367 else if (t == typeof(short) || t == typeof(ushort))
368 { DataType = CellType.Number; }
369 else if (t == typeof(DateTime)) // Not native but standard
370 {
371 DataType = CellType.Date;
373 }
374
375 else if (t == typeof(TimeSpan)) // Not native but standard
376 {
377 DataType = CellType.Time;
379 }
380 else { DataType = CellType.String; } // Default (char, string, object)
381 }
382
390 public void SetCellLockedState(bool isLocked, bool isHidden)
391 {
392 Style lockStyle;
393 if (cellStyle == null)
394 {
395 lockStyle = new Style();
396 }
397 else
398 {
399 lockStyle = cellStyle.CopyStyle();
400 }
401 lockStyle.CurrentCellXf.Locked = isLocked;
402 lockStyle.CurrentCellXf.Hidden = isHidden;
403 SetStyle(lockStyle);
404 }
405
412 public Style SetStyle(Style style, bool unmanaged = false)
413 {
414 if (style == null)
415 {
416 throw new StyleException("No style to assign was defined");
417 }
418 cellStyle = unmanaged ? style : StyleRepository.Instance.AddStyle(style);
419 return cellStyle;
420 }
421
426 internal Cell Copy()
427 {
428 Cell copy = new Cell
429 {
430 value = this.value,
431 DataType = this.DataType,
432 CellAddress = this.CellAddress,
433 CellAddressType = this.CellAddressType
434 };
435 if (this.cellStyle != null)
436 {
437 copy.SetStyle(this.cellStyle, true);
438 }
439 return copy;
440 }
445 public override int GetHashCode()
446 {
447 unchecked
448 {
449 int hash = 17;
450 hash = hash * 31 + columnNumber.GetHashCode();
451 hash = hash * 31 + rowNumber.GetHashCode();
452 hash = hash * 31 + CellAddressType.GetHashCode();
453 hash = hash * 31 + DataType.GetHashCode();
454 hash = hash * 31 + (cellStyle?.GetHashCode() ?? 0);
455 hash = hash * 31 + (value?.GetHashCode() ?? 0);
456 return hash;
457 }
458 }
459
466 public static bool operator ==(Cell left, Cell right)
467 {
468 if (ReferenceEquals(left, null))
469 {
470 return ReferenceEquals(right, null);
471 }
472
473 return left.Equals(right);
474 }
475
482 public static bool operator !=(Cell left, Cell right)
483 {
484 return !(left == right);
485 }
486
496 public static bool operator <(Cell left, Cell right)
497 {
498 return ReferenceEquals(left, null) ? !ReferenceEquals(right, null) : left.CompareTo(right) < 0;
499 }
500
510 public static bool operator <=(Cell left, Cell right)
511 {
512 return ReferenceEquals(left, null) || left.CompareTo(right) <= 0;
513 }
514
524 public static bool operator >(Cell left, Cell right)
525 {
526 return !ReferenceEquals(left, null) && left.CompareTo(right) > 0;
527 }
528
538 public static bool operator >=(Cell left, Cell right)
539 {
540 return ReferenceEquals(left, null) ? ReferenceEquals(right, null) : left.CompareTo(right) >= 0;
541 }
542
543 #endregion
544
545 #region staticMethods
552 public static IEnumerable<Cell> ConvertArray<T>(IEnumerable<T> list)
553 {
554 List<Cell> output = new List<Cell>();
555 if (list == null)
556 {
557 return output;
558 }
559 Cell c;
560 object o;
561 Type t;
562 foreach (T item in list)
563 {
564 if (item == null) // DO NOT LISTEN to code suggestions! This is wrong for bool: if (object.Equals(item, default(T)))
565 {
566 c = new Cell(null, CellType.Empty);
567 output.Add(c);
568 continue;
569 }
570 o = item; // intermediate object is necessary to cast the types below
571 t = item.GetType();
572 if (t == typeof(Cell))
573 { c = item as Cell; }
574 else if (t == typeof(bool))
575 { c = new Cell((bool)o, CellType.Bool); }
576 else if (t == typeof(byte))
577 { c = new Cell((byte)o, CellType.Number); }
578 else if (t == typeof(sbyte))
579 { c = new Cell((sbyte)o, CellType.Number); }
580 else if (t == typeof(decimal))
581 { c = new Cell((decimal)o, CellType.Number); }
582 else if (t == typeof(double))
583 { c = new Cell((double)o, CellType.Number); }
584 else if (t == typeof(float))
585 { c = new Cell((float)o, CellType.Number); }
586 else if (t == typeof(int))
587 { c = new Cell((int)o, CellType.Number); }
588 else if (t == typeof(uint))
589 { c = new Cell((uint)o, CellType.Number); }
590 else if (t == typeof(long))
591 { c = new Cell((long)o, CellType.Number); }
592 else if (t == typeof(ulong))
593 { c = new Cell((ulong)o, CellType.Number); }
594 else if (t == typeof(short))
595 { c = new Cell((short)o, CellType.Number); }
596 else if (t == typeof(ushort))
597 { c = new Cell((ushort)o, CellType.Number); }
598 else if (t == typeof(DateTime))
599 {
600 c = new Cell((DateTime)o, CellType.Date);
601 c.SetStyle(BasicStyles.DateFormat);
602 }
603 else if (t == typeof(TimeSpan))
604 {
605 c = new Cell((TimeSpan)o, CellType.Time);
606 c.SetStyle(BasicStyles.TimeFormat);
607 }
608 else if (t == typeof(string))
609 { c = new Cell((string)o, CellType.String); }
610 else // Default = unspecified object
611 {
612 c = new Cell(o.ToString(), CellType.Default);
613 }
614 output.Add(c);
615 }
616 return output;
617 }
618
626 public static IEnumerable<Address> GetCellRange(string range)
627 {
628 Range range2 = ResolveCellRange(range);
629 return GetCellRange(range2.StartAddress, range2.EndAddress);
630 }
631
640 public static IEnumerable<Address> GetCellRange(string startAddress, string endAddress)
641 {
642 Address start = ResolveCellCoordinate(startAddress);
643 Address end = ResolveCellCoordinate(endAddress);
644 return GetCellRange(start, end);
645 }
646
656 public static IEnumerable<Address> GetCellRange(int startColumn, int startRow, int endColumn, int endRow)
657 {
658 Address start = new Address(startColumn, startRow);
659 Address end = new Address(endColumn, endRow);
660 return GetCellRange(start, end);
661 }
662
671 public static IEnumerable<Address> GetCellRange(Address startAddress, Address endAddress)
672 {
673 int startColumn;
674 int endColumn;
675 int startRow;
676 int endRow;
677 if (startAddress.Column < endAddress.Column)
678 {
679 startColumn = startAddress.Column;
680 endColumn = endAddress.Column;
681 }
682 else
683 {
684 startColumn = endAddress.Column;
685 endColumn = startAddress.Column;
686 }
687 if (startAddress.Row < endAddress.Row)
688 {
689 startRow = startAddress.Row;
690 endRow = endAddress.Row;
691 }
692 else
693 {
694 startRow = endAddress.Row;
695 endRow = startAddress.Row;
696 }
697 List<Address> output = new List<Address>();
698 for (int column = startColumn; column <= endColumn; column++)
699 {
700 for (int row = startRow; row <= endRow; row++)
701 {
702 output.Add(new Address(column, row));
703 }
704 }
705 return output;
706 }
707
716 public static string ResolveCellAddress(int column, int row, AddressType type = AddressType.Default)
717 {
718 ValidateColumnNumber(column);
720 switch (type)
721 {
722 case AddressType.FixedRowAndColumn:
723 return "$" + ResolveColumnAddress(column) + "$" + (row + 1);
724 case AddressType.FixedColumn:
725 return "$" + ResolveColumnAddress(column) + (row + 1);
726 case AddressType.FixedRow:
727 return ResolveColumnAddress(column) + "$" + (row + 1);
728 default:
729 return ResolveColumnAddress(column) + (row + 1);
730 }
731 }
732
740 public static Address ResolveCellCoordinate(string address)
741 {
742 int row;
743 int column;
744 AddressType type;
745 ResolveCellCoordinate(address, out column, out row, out type);
746 return new Address(column, row, type);
747 }
748
757 public static void ResolveCellCoordinate(string address, out int column, out int row)
758 {
759 ResolveCellCoordinate(address, out column, out row, out _);
760 }
761
771 public static void ResolveCellCoordinate(string address, out int column, out int row, out AddressType addressType)
772 {
773 if (string.IsNullOrEmpty(address))
774 {
775 throw new FormatException("The cell address is null or empty and could not be resolved");
776 }
777
778 int i = 0;
779 int len = address.Length;
780 bool fixedCol = false;
781 bool fixedRow = false;
782
783 // Optional $ for column
784 if (i < len && address[i] == '$') { fixedCol = true; i++; }
785
786 // Column letters
787 int colStart = i;
788 while (i < len && ((address[i] >= 'A' && address[i] <= 'Z') || (address[i] >= 'a' && address[i] <= 'z')))
789 {
790 i++;
791 }
792 if (i == colStart)
793 {
794 throw new FormatException("The format of the cell address (" + address + ") is malformed");
795 }
796
797 string colPart = address.Substring(colStart, i - colStart);
798
799 // Optional $ for row
800 if (i < len && address[i] == '$') { fixedRow = true; i++; }
801
802 // Row digits
803 int rowStart = i;
804 while (i < len && address[i] >= '0' && address[i] <= '9')
805 {
806 i++;
807 }
808
809 if (i == rowStart || i != len)
810 {
811 throw new FormatException("The format of the cell address (" + address + ") is malformed");
812 }
813
814 row = int.Parse(address.Substring(rowStart, i - rowStart), NumberStyles.Integer, CultureInfo.InvariantCulture) - 1;
815 column = ResolveColumn(colPart);
817
818 if (fixedCol && fixedRow) { addressType = AddressType.FixedRowAndColumn; }
819 else if (fixedCol) { addressType = AddressType.FixedColumn; }
820 else if (fixedRow) { addressType = AddressType.FixedRow; }
821 else { addressType = AddressType.Default; }
822 }
823
831 public static Range ResolveCellRange(string range)
832 {
833 if (string.IsNullOrEmpty(range))
834 {
835 throw new FormatException("The cell range is null or empty and could not be resolved");
836 }
837 if (!range.Contains(":"))
838 {
839 return new Range(ResolveCellCoordinate(range), ResolveCellCoordinate(range));
840 }
841 string[] split = range.Split(':');
842 if (split.Length != 2)
843 {
844 throw new FormatException("The cell range (" + range + ") is malformed and could not be resolved");
845 }
846 return new Range(ResolveCellCoordinate(split[0]), ResolveCellCoordinate(split[1]));
847 }
848
855 public static int ResolveColumn(string columnAddress)
856 {
857 if (String.IsNullOrEmpty(columnAddress))
858 {
859 throw new RangeException("The passed address was null or empty");
860 }
861 columnAddress = ParserUtils.ToUpper(columnAddress);
862 int chr;
863 int result = 0;
864 int multiplier = 1;
865 for (int i = columnAddress.Length - 1; i >= 0; i--)
866 {
867 chr = columnAddress[i];
868 chr -= ASCII_OFFSET;
869 result += (chr * multiplier);
870 multiplier *= 26;
871 }
872 ValidateColumnNumber(result - 1);
873 return result - 1;
874 }
875
882 public static string ResolveColumnAddress(int columnNumber)
883 {
884 ValidateColumnNumber(columnNumber);
885 // A - XFD
886 StringBuilder sb = new StringBuilder();
887 columnNumber++;
888 while (columnNumber > 0)
889 {
890 columnNumber--;
891 sb.Insert(0, (char)('A' + (columnNumber % 26)));
892 columnNumber /= 26;
893 }
894 return sb.ToString();
895 }
896
902 public static AddressScope GetAddressScope(string addressExpression)
903 {
904 try
905 {
906 ResolveCellCoordinate(addressExpression);
907 return AddressScope.SingleAddress;
908 }
909 catch
910 {
911 try
912 {
913 ResolveCellRange(addressExpression);
914 return AddressScope.Range;
915 }
916 catch
917 {
918 return AddressScope.Invalid;
919 }
920 }
921
922 }
923
929 public static void ValidateColumnNumber(int column)
930 {
931 if (column > Worksheet.MaxColumnNumber || column < Worksheet.MinColumnNumber)
932 {
933 throw new RangeException("The column number (" + column + ") is out of range. Range is from " +
934 Worksheet.MinColumnNumber + " to " + Worksheet.MaxColumnNumber + " (" + (Worksheet.MaxColumnNumber + 1) + " columns).");
935 }
936 }
937
943 public static void ValidateRowNumber(int row)
944 {
945 if (row > Worksheet.MaxRowNumber || row < Worksheet.MinRowNumber)
946 {
947 throw new RangeException("The row number (" + row + ") is out of range. Range is from " +
948 Worksheet.MinRowNumber + " to " + Worksheet.MaxRowNumber + " (" + (Worksheet.MaxRowNumber + 1) + " rows).");
949 }
950 }
951 #endregion
952
953 }
954}
Class representing a cell of a worksheet.
Definition Cell.cs:23
static Address ResolveCellCoordinate(string address)
Gets the column and row number (zero based) of a cell by the address.
Definition Cell.cs:740
static bool operator==(Cell left, Cell right)
Determines whether two Cell instances are equal.
Definition Cell.cs:466
override int GetHashCode()
Gets the hash code of the cell.
Definition Cell.cs:445
static IEnumerable< Address > GetCellRange(Address startAddress, Address endAddress)
Get a list of cell addresses from a cell range.
Definition Cell.cs:671
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:656
CellType
Enum defines the basic data types of a cell.
Definition Cell.cs:33
@ String
Type for single characters and strings.
Definition Cell.cs:36
@ Formula
Type for Formulas (The cell will be handled differently).
Definition Cell.cs:47
@ Date
Type for dates (Note: Dates before 1900-01-01 and after 9999-12-31 are not allowed).
Definition Cell.cs:41
@ Default
Default Type, not specified.
Definition Cell.cs:51
@ Time
Type for times (Note: Internally handled as OAdate, represented by TimeSpan).
Definition Cell.cs:43
@ Number
Type for all numeric types (long, integer, float, double, short, byte and decimal; signed and unsigne...
Definition Cell.cs:39
@ Bool
Type for boolean.
Definition Cell.cs:45
@ Empty
Type for empty cells. This type is only used for merged cells (all cells except the first of the cell...
Definition Cell.cs:49
Cell()
Default constructor. Cells created with this constructor do not have a link to a worksheet initially.
Definition Cell.cs:177
static IEnumerable< Cell > ConvertArray< T >(IEnumerable< T > list)
Converts a List of supported objects into a list of cells.
Definition Cell.cs:552
void SetCellLockedState(bool isLocked, bool isHidden)
Sets the lock state of the cell.
Definition Cell.cs:390
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:943
Address CellAddress2
Gets or sets the combined cell Address as Address object.
Definition Cell.cs:109
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:716
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:902
static bool operator<(Cell left, Cell right)
Determines whether the first instance of a Cell is less/smaller as the second.
Definition Cell.cs:496
AddressType
Enum for the referencing style of the address.
Definition Cell.cs:58
@ FixedColumn
Column of the address is fixed (e.g. '$C3').
Definition Cell.cs:64
@ FixedRow
Row of the address is fixed (e.g. 'C$3').
Definition Cell.cs:62
@ FixedRowAndColumn
Row and column of the address is fixed (e.g. '$C$3').
Definition Cell.cs:66
Style CellStyle
Gets the assigned style of the cell.
Definition Cell.cs:123
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:538
static IEnumerable< Address > GetCellRange(string startAddress, string endAddress)
Get a list of cell addresses from a cell range.
Definition Cell.cs:640
static Range ResolveCellRange(string range)
Resolves a cell range from the format like A1:B3 or AAD556:AAD1000.
Definition Cell.cs:831
int RowNumber
Gets or sets the number of the row (zero-based).
Definition Cell.cs:146
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:929
static int ResolveColumn(string columnAddress)
Gets the column number from the column address (A - XFD).
Definition Cell.cs:855
CellType DataType
Gets or sets the type of the cell.
Definition Cell.cs:140
static bool operator!=(Cell left, Cell right)
Determines whether two Cell instances are not equal.
Definition Cell.cs:482
override bool Equals(object obj)
Compares two objects whether they are addresses and equal.
Definition Cell.cs:304
string CellAddress
Gets or sets the combined cell Address as string in the format A1 - XFD1048576. The address may conta...
Definition Cell.cs:97
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:212
AddressScope
Enum to define the scope of a passed address string (used in static context).
Definition Cell.cs:73
@ SingleAddress
The address represents a single cell.
Definition Cell.cs:75
@ Invalid
The address expression is invalid.
Definition Cell.cs:79
@ Range
The address represents a range of cells.
Definition Cell.cs:77
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:771
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:237
int ColumnNumber
Gets or sets the number of the column (zero-based).
Definition Cell.cs:130
Cell(object value, CellType type, int column, int row)
Constructor with value, cell type, row number and column number.
Definition Cell.cs:264
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:188
Style SetStyle(Style style, bool unmanaged=false)
Sets the style of the cell.
Definition Cell.cs:412
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:626
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:342
AddressType CellAddressType
Gets or sets the optional address type that can be part of the cell address.
Definition Cell.cs:159
static bool operator>(Cell left, Cell right)
Determines whether the first instance of a Cell is greater/larger as the second.
Definition Cell.cs:524
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:757
object Value
Gets or sets the value of the cell (generic object type). When setting a value, the DataType is autom...
Definition Cell.cs:163
static string ResolveColumnAddress(int columnNumber)
Gets the column address (A - XFD).
Definition Cell.cs:882
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:510
int CompareTo(Cell other)
Implemented CompareTo method.
Definition Cell.cs:285
void RemoveStyle()
Removes the assigned style from the cell.
Definition Cell.cs:333
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:27
static readonly int MinColumnNumber
Minimum column number (zero-based) as constant.
Definition Worksheet.cs:54
static readonly int MaxRowNumber
Maximum row number (zero-based) as constant.
Definition Worksheet.cs:75
static readonly int MaxColumnNumber
Maximum column number (zero-based) as constant.
Definition Worksheet.cs:49
static readonly int MinRowNumber
Minimum row number (zero-based) as constant.
Definition Worksheet.cs:80
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