Skip to content

Novis\Spreadsheet\Style::Underline

One or two lines under the text of a cell.

You set it with the style field underline of Style::of. Style::of turns the value into a Style::Underline case:

  • true and 'single' are Single, one line under the text.
  • 'double' is Double, two lines under the text.
  • false gives no underline.

Any other string throws a LogicError.

Examples

One or two lines

<?nvs
// Shows the `Style::Underline` that each value of the style field `underline` gives.
use Novis\Spreadsheet\Style;
class Underlines
{
// Returns the name of an underline, or "none" when the text has no underline.
public static function name(?Style::Underline $underline): string
{
return match ($underline) {
Style::Underline::Single => 'Single',
Style::Underline::Double => 'Double',
null => 'none',
};
}
}
// `true` is the same as "single". This prints "Single".
echo Underlines::name(Style::of({ underline: true })->fields->underline), "\n";
// This prints "Double".
echo Underlines::name(Style::of({ underline: 'double' })->fields->underline), "\n";
// `false` gives no underline. This prints "none".
echo Underlines::name(Style::of({ underline: false })->fields->underline), "\n";
Output
Single
Double
none