-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
263 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
// | ||
// Copyright 2022-2025, John McNamara, [email protected] | ||
|
||
//! The following example demonstrates quoting worksheet names. | ||
use rust_xlsxwriter::utility; | ||
|
||
fn main() { | ||
// Doesn't need to be quoted. | ||
let result = utility::quote_sheet_name("Sheet1"); | ||
assert_eq!(result, "Sheet1"); | ||
|
||
// Spaces need to be quoted. | ||
let result = utility::quote_sheet_name("Sheet 1"); | ||
assert_eq!(result, "'Sheet 1'"); | ||
|
||
// Special characters need to be quoted. | ||
let result = utility::quote_sheet_name("Sheet-1"); | ||
assert_eq!(result, "'Sheet-1'"); | ||
|
||
// Single quotes need to be escaped with a quote. | ||
let result = utility::quote_sheet_name("Sheet'1"); | ||
assert_eq!(result, "'Sheet''1'"); | ||
|
||
// A1 style cell references don't need to be quoted. | ||
let result = utility::quote_sheet_name("A1"); | ||
assert_eq!(result, "'A1'"); | ||
|
||
// R1C1 style cell references need to be quoted. | ||
let result = utility::quote_sheet_name("RC1"); | ||
assert_eq!(result, "'RC1'"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.