Table of Contents

Class XLHelper

Namespace
SlapKit.Excel.Excel
Assembly
SlapKit.Excel.dll

Common methods

public static class XLHelper
Inheritance
XLHelper
Inherited Members

Fields

Epsilon

public const double Epsilon = 1E-10

Field Value

double

MaxColumnLetter

public const string MaxColumnLetter = "XFD"

Field Value

string

MaxColumnNumber

public const int MaxColumnNumber = 16384

Field Value

int

MaxRowNumber

public const int MaxRowNumber = 1048576

Field Value

int

MinColumnNumber

public const int MinColumnNumber = 1

Field Value

int

MinRowNumber

public const int MinRowNumber = 1

Field Value

int

NoBomUTF8

public static Encoding NoBomUTF8

Field Value

Encoding

Properties

LastCell

public static string LastCell { get; }

Property Value

string

Methods

AreEqual(double, double)

public static bool AreEqual(double d1, double d2)

Parameters

d1 double
d2 double

Returns

bool

CreateSafeSheetName(string, char)

Creates a valid sheet name, which conforms to the following rules. A sheet name: is never null, has minimum length of 1 and maximum length of 31, doesn't contain special chars: (: 0x0000 0x0003 / \ ? * ] [). Sheet names must not begin or end with ' (apostrophe)

public static string CreateSafeSheetName(string nameProposal, char replaceChar = ' ')

Parameters

nameProposal string

can be any string, will be truncated if necessary, allowed to be null

replaceChar char

the char to replace invalid characters.

Returns

string

a valid string, "empty" if too short, "null" if null

GetColumnLetterFromNumber(int, bool)

Gets the column letter of a given column number.

public static string GetColumnLetterFromNumber(int columnNumber, bool trimToAllowed = false)

Parameters

columnNumber int

The column number to translate into a column letter.

trimToAllowed bool

if set to true the column letter will be restricted to the allowed range.

Returns

string

GetColumnNumberFromAddress(string)

public static int GetColumnNumberFromAddress(string cellAddressString)

Parameters

cellAddressString string

Returns

int

GetColumnNumberFromLetter(string)

Gets the column number of a given column letter.

public static int GetColumnNumberFromLetter(string columnLetter)

Parameters

columnLetter string

The column letter to translate into a column number.

Returns

int

GetDate(object)

public static DateTime GetDate(object v)

Parameters

v object

Returns

DateTime

IsValidA1Address(string)

public static bool IsValidA1Address(string address)

Parameters

address string

Returns

bool

IsValidColumn(string)

public static bool IsValidColumn(string column)

Parameters

column string

Returns

bool

IsValidRCAddress(string)

public static bool IsValidRCAddress(string address)

Parameters

address string

Returns

bool

IsValidRangeAddress(IXLRangeAddress)

public static bool IsValidRangeAddress(IXLRangeAddress rangeAddress)

Parameters

rangeAddress IXLRangeAddress

Returns

bool

IsValidRangeAddress(string)

public static bool IsValidRangeAddress(string rangeAddress)

Parameters

rangeAddress string

Returns

bool

IsValidRow(string)

public static bool IsValidRow(string rowString)

Parameters

rowString string

Returns

bool

ValidateName(string, string, string, IEnumerable<string>, out string)

public static bool ValidateName(string objectType, string newName, string oldName, IEnumerable<string> existingNames, out string message)

Parameters

objectType string
newName string
oldName string
existingNames IEnumerable<string>
message string

Returns

bool

ValidateSheetName(string)

Validates the name of the sheet. The character count MUST be greater than or equal to 1 and less than or equal to 31. The string MUST NOT contain the any of the following characters:

  • 0x0000
  • 0x0003
  • colon (:)
  • backslash()
  • asterisk(*)
  • question mark(?)
  • forward slash(/)
  • opening square bracket([)
  • closing square bracket(]) The string MUST NOT begin or end with the single quote(') character.
public static void ValidateSheetName(string sheetName)

Parameters

sheetName string

Name of the sheet.

Exceptions

ArgumentException