Closed barsa-net closed 5 months ago
would it be possible in a future release to make it just
pub
?
Sure. I can do that. I'll just need to change the error handling around a bit. I'll add it in the next release.
I've added a public utility::check_sheet_name()
function to main.
Example:
use rust_xlsxwriter::{utility, XlsxError};
fn main() -> Result<(), XlsxError> {
// This worksheet name is valid.
utility::check_sheet_name("2030-01-01")?;
// This worksheet name isn't valid due to the forward slashes.
utility::check_sheet_name("2030/01/01")?;
Ok(())
}
Output:
$ cargo run --example doc_utility_check_sheet_name
Finished dev [unoptimized + debuginfo] target(s) in 0.17s
Running `target/debug/examples/doc_utility_check_sheet_name`
Error: SheetnameContainsInvalidCharacter("Invalid Excel worksheet name '2030/01/01'")
Let me know if that works for you.
That works perfectly, thanks!
Thanks for testing. I will close the request. The feature will be in the next release.
This is now upstream in v0.63.0. Thanks for the input.
Question
Currently utility::validate_sheetname visibility is set as
pub(crate)
, would it be possible in a future release to make it justpub
?I ask this because in my current use case I would like to check a sheet name validity before using
set_name()
without the need to reimplement the same logic ofvalidate_sheetname()
.