You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Changelog.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
## v3.0.0-rc.5
4
4
5
5
---
6
-
Release Date: **22.12.2025**
6
+
Release Date: **04.01.2026**
7
7
8
8
- Added explicit operator for Address to convert from string to Address (string can be cast to address explicitly)
9
9
- Added implicit operator for Range to convert from string to Range (string can be cast to range implicitly)
@@ -13,7 +13,10 @@ Release Date: **22.12.2025**
13
13
- ThemeColor (Color, defined by theme elements)
14
14
- SystemColor (Color, defined by system colors)
15
15
- AutoColor (automatic color, no value / dummy class)
16
+
- Changed the type of `Font.ColorValue` from string to Color (can be sRGB/ARGB, Indexed, Theme, System or Auto)
17
+
- Removed the property `Font.ColorTheme`, since only relevant for theme colors. The value is now handled by `Font.ColorValue`, in case of a ThemeColor
16
18
- Re-implementation of the Fill class to use the new Color class for color representation of the foreground and background colors (indexed property removed)
19
+
- Removed the property `Fill.IndexedColor`, since only relevant for Indexed colors. The value is now handled by `Fill.ForegroundColor` or `Fill.BackgroundColor`, in case of a IndexedColor
17
20
- Added implicit operator for Fill to create a fill color by a string (RGB or ARGB value)
18
21
- Added implicit operator for Fill to create a fill color by an integer (indexed color value)
Copy file name to clipboardExpand all lines: MigrationGuide.md
+47-8Lines changed: 47 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,14 +125,23 @@ The following guide lists all necessary changes, as well as changed behaviors of
125
125
- The property `Row` is now read-only (immutable). To change the property, a new Address object has to be created
126
126
- The property `Column` is now read-only (immutable). To change the property, a new Address object has to be created
127
127
- The property `Type` is now read-only (immutable). To change the property, a new Address object has to be created
128
+
- An Address object can now be de defined by an explicit cast (implicit casting was not realized due to potential issues with object comparison). Example:
129
+
```cs
130
+
stingaddressString="A15";
131
+
Addressaddress= (Address)addressString;
132
+
```
128
133
129
134
---
130
135
131
136
### Range (struct)
132
137
133
138
- The property `StartAddress` is now read-only (immutable). To change the property, a new Range object has to be created
134
139
- The property `EndAddress` is now read-only (immutable). To change the property, a new Range object has to be created
135
-
140
+
- A Range object can now be de defined by an implicit cast using a string. Example:
// ApplicableDefined is usually ignored, and Default may be used instead
198
207
```
199
208
200
-
- The property `Font.ColorScheme` was changed from type `int` to the enum `Theme.ColorSchemeElement`. The value has to be replaced by one of the available values (See **Theme section** ). The initialization default value is `Theme.ColorSchemeElement.light1`.
209
+
- The property `Font.ColorValue` was changed from type `string ` to the new `Color` class (namespace `NanoXLSX.Colors`). The new Color class can represent an RGB, ARGB, system, theme or indexed color. However, there are also implicit conversions. See the Color class documentation for more details. Usage examples:
font3.ColorValue=Color.CreateTheme(Theme.ColorSchemeElement.Accent1, 0.5f); // Theme color with tint
221
+
222
+
// Implicit creation of specific color from a string (ARGB):
223
+
Fontfont4=newFont();
224
+
font4.ColorValue="FF00FF00"; // Implicit conversion to SrgbColor
225
+
226
+
// Implicit creation of font from an int (indexed color):
227
+
Fontfont5=newFont();
228
+
Fontfont5.ColorValue=IndexedColor.Value.Black; // Implicit conversion to IndexedColor as background
229
+
230
+
// Implicit creation of specific color from an int (color index):
231
+
Fontfont6=newFont();
232
+
font6.ColorValue=63; // Implicit conversion to IndexedColor
233
+
234
+
// Implicit creation of specific color from an enum value (color index):
235
+
Fontfont7=newFont();
236
+
font7.ColorValue=IndexedColor.Value.Magenta; // Implicit conversion to IndexedColor enum value
237
+
```
238
+
239
+
- The property `Font.ColorTheme` was completely removed. This value is only relevant, if the property `Font.ColorValue` is of the type `ThemeColor`. All references are to be removed.
201
240
- The property `Font.VerticalAlign` was changed from type `Font.VerticalAlignValue` to the enum `Font.VerticalTextAlignValue`. Only the enum name has to be changed (see below):
202
241
- The enum `Font.VerticalAlignValue` was renamed to `Font.VerticalTextAlignValue`. The available values remain unchanged
203
242
@@ -262,7 +301,7 @@ Fill was completely overhauled in version 3.0.0, to support more flexible color
262
301
- The static method `Fill.ValidateColr(string,bool, bool)` was moved to the utils class `Validators.ValidateColr(string,bool, bool)` in namespace `NanoXLSX.Utils`. The class has to be changed in the code, but the method signature remains unchanged.
263
302
- The property `Fill.BackgroundColor` was changed from type `string` to the new `Color` class (namespace `NanoXLSX.Colors`). The new Color class can represent an RGB, ARGB, system, theme or indexed color. See the Color class documentation for more details.
264
303
- The property `Fill.ForegroundColor` was changed from type `string` to the new `Color` class (namespace `NanoXLSX.Colors`). The new Color class can represent an RGB, ARGB, system, theme or indexed color. See the Color class documentation for more details.
265
-
- The property `IndexedColor` was removed and is now part of the new `Color` class, applied to `BackgroundColor` and `ForegroundColor`. In the `Color` class, there is a property `IndexedColor` that holds an object of the type `IndexedColor` (namespace `NanoXLSX.Themes`). The original `int` value has to be replaced by one of the available enum values in the class `IndexedColor`. Usage example:
304
+
- The property `IndexedColor` was removed and is now part of the new `Color` class, applied to `BackgroundColor` and `ForegroundColor`. In the `Color` class, there is a property `IndexedColor` that holds an object of the type `IndexedColor` (namespace `NanoXLSX.Themes`). The original `int` value has to be replaced by one of the available enum values in the class `IndexedColor`. However, there are also implicit conversions. See the Color class documentation for more details. Usage examples:
/// \remark <remarks>Although tint is generally specified for all color types, according to the OOXML specifications, it seems only to have an effect on colors of the type <see cref="ThemeColor"/>. Therefore, the value is also not written on any color except ThemeColor</remarks>
78
79
publicdouble?Tint{get;set;}
79
80
80
81
/// <summary>
@@ -340,6 +341,29 @@ public static implicit operator Color(IndexedColor.Value colorIndex)
340
341
returnCreateIndexed(colorIndex);
341
342
}
342
343
344
+
/// <summary>
345
+
/// String representation od a Color instance
346
+
/// </summary>
347
+
/// <returns>String value</returns>
348
+
publicoverridestringToString()
349
+
{
350
+
switch(Type)
351
+
{
352
+
caseColorType.Rgb:
353
+
return"RGBColor:"+RgbColor.StringValue;
354
+
caseColorType.Indexed:
355
+
return"IndexedColor:"+IndexedColor.StringValue;
356
+
caseColorType.Theme:
357
+
return"ThemeColor:"+ThemeColor.StringValue;
358
+
caseColorType.System:
359
+
return"SystemColor:"+SystemColor.StringValue;
360
+
caseColorType.Auto:
361
+
return"Auto-Color";
362
+
default:
363
+
return"Undefined Color";
364
+
}
365
+
}
366
+
343
367
344
368
/// <summary>
345
369
/// Determines whether the specified object is equal to the current object
/// Gets or sets the font color theme, represented by a color scheme
312
-
/// </summary>
313
-
[Append]
314
-
//TODO: v3> Reference to Theming
315
-
//OOXML: Chp.18.8.3 and 20.1.6.2
316
-
publicColorSchemeElementColorTheme
317
-
{
318
-
get=>colorTheme;
319
-
set
320
-
{
321
-
if(value==null)
322
-
{
323
-
thrownewStyleException("A color theme cannot be null");
324
-
}
325
-
colorTheme=value;
326
-
}
327
-
}
328
-
/// <summary>
329
-
/// Gets or sets the color code of the font color. The value is expressed as hex string with the format AARRGGBB. AA (Alpha) is usually FF. If set, the value will be cast to upper case
310
+
/// Gets or sets the color code of the font color. The value is an instance of <see cref="Color"/>
330
311
/// To omit the color, an empty string can be set. Empty is also default.
331
312
/// </summary>
332
-
/// <exception cref="StyleException">Throws a StyleException if the passed ARGB value is not valid</exception>
333
313
[Append]
334
-
publicstringColorValue
314
+
publicColorColorValue
335
315
{
336
-
get=>colorValue;
337
-
set
338
-
{
339
-
Validators.ValidateColor(value,true,true);
340
-
if(value!=null)
341
-
{
342
-
colorValue=ParserUtils.ToUpper(value);
343
-
}
344
-
else
345
-
{
346
-
colorValue=value;
347
-
}
348
-
}
316
+
get;set;
349
317
}
350
318
/// <summary>
351
319
/// Gets or sets the font family (Default is 2 = Swiss)
352
320
/// </summary>
353
321
[Append]
354
-
//TODO: v3> Refactor to enum according to specs (18.18.94)
355
-
//OOXML: Chp.18.8.18 and 18.18.94
356
322
publicFontFamilyValueFamily{get;set;}
357
323
/// <summary>
358
324
/// Gets whether the font is equal to the default font
@@ -367,7 +333,6 @@ public bool IsDefaultFont
367
333
}
368
334
}
369
335
370
-
371
336
/// <summary>
372
337
/// Gets or sets the font name (Default is Calibri)
373
338
/// </summary>
@@ -417,13 +382,13 @@ public float Size
417
382
/// <summary>
418
383
/// Default constructor
419
384
/// </summary>
385
+
/// \remark <remarks>When using the default constructor, an object of type <see cref="Color"/> with the type <see cref="Color.ColorType.None"/> will be created for the property <see cref="Font.ColorValue"/>. To set a font color, the property has to be updated with a new value</remarks>
420
386
publicFont()
421
387
{
422
388
size=DefaultFontSize;
423
389
Name=DefaultFontName;
424
390
Family=DefaultFontFamily;
425
-
ColorTheme=ColorSchemeElement.Light1;
426
-
ColorValue=string.Empty;
391
+
ColorValue=Color.CreateNone();// Default is none
427
392
Scheme=DefaultFontScheme;
428
393
VerticalAlign=DefaultVerticalAlign;
429
394
}
@@ -464,7 +429,6 @@ public override string ToString()
0 commit comments