Skip to contents

Adjust the specified tab/sheet names character count to be within reasonable values and notify user with a warning when changes are made

Note: min checks should already have been done in scrub_tabnames() before passing width info

Usage

.check_tabwidth(width = 31, min_width = 0, quiet = FALSE)

Arguments

width

the number of characters user requested for the tab/sheet names

min_width

the minimum number of characters to permit in a tab/sheet name

quiet

quiet overrides to the tab/sheet names

Value

between 0 and 31 where returned number is as close to user request as possible after adjusting for reasonableness on input data

Examples

xlr:::.check_tabwidth(31)
#> [1] 31
xlr:::.check_tabwidth(3, 4)
#> ! The minimum width must be greater than the number of characters required
#>         to differentiate possible duplicated tabnames plus the characters in `sep`.
#>         
#> Setting the tabname character width to 4.
#> [1] 4
xlr:::.check_tabwidth(34)
#> ! Excel limits sheetnames to 31 characters.
#> Longer names cause write failure.
#> Setting max_width to 31 characters and truncating longer names.
#> [1] 31