Created
January 6, 2015 13:42
-
-
Save andy-williams/0937dc5183549b007486 to your computer and use it in GitHub Desktop.
CellValuesExtension for OpenXML library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class CellValuesExtension | |
{ | |
public static bool IsBoolean(this EnumValue<CellValues> cellValues) | |
{ | |
return IsNotEmpty(cellValues) && cellValues.Value == CellValues.Boolean; | |
} | |
public static bool IsDate(this EnumValue<CellValues> cellValues) | |
{ | |
return IsNotEmpty(cellValues) && cellValues.Value == CellValues.Date; | |
} | |
public static bool IsString(this EnumValue<CellValues> cellValues) | |
{ | |
return IsNotEmpty(cellValues) && cellValues.Value == CellValues.String; | |
} | |
public static bool IsSharedString(this EnumValue<CellValues> cellValues) | |
{ | |
return IsNotEmpty(cellValues) && cellValues.Value == CellValues.SharedString; | |
} | |
public static bool IsNumber(this EnumValue<CellValues> cellValues) | |
{ | |
return IsNotEmpty(cellValues) && cellValues.Value == CellValues.Number; | |
} | |
public static bool IsInlineString(this EnumValue<CellValues> cellValues) | |
{ | |
return IsNotEmpty(cellValues) && cellValues.Value == CellValues.InlineString; | |
} | |
public static bool IsError(this EnumValue<CellValues> cellValues) | |
{ | |
return IsNotEmpty(cellValues) && cellValues.Value == CellValues.Error; | |
} | |
private static bool IsNotEmpty(EnumValue<CellValues> cellValues) | |
{ | |
return cellValues != null && cellValues.HasValue; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment