Table of Contents

Method Normalize

Namespace
DocWright.Formats.Xlsx
Assembly
DocWright.Formats.Xlsx.dll

Normalize(string?, string)

Derives a legal worksheet name from arbitrary text.

public static string Normalize(string? text, string fallback)

Parameters

text string

The text, which may be null, empty or illegal.

fallback string

The name to use when nothing usable survives.

Returns

string

A name IsValid(string?) accepts.

Remarks

Forbidden characters become spaces rather than being deleted, so two names that differ only in punctuation stay different; the result is trimmed, truncated to MaxLength and replaced by fallback when it comes out empty. Uniqueness across a workbook is the caller's to arrange — this method cannot see the other sheets.