Skip to content

Commit

Permalink
cond format: add extra tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcnamara committed Nov 17, 2023
1 parent 558348e commit a8274ed
Show file tree
Hide file tree
Showing 2 changed files with 532 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/conditional_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2340,6 +2340,7 @@ impl ConditionalFormatText {
let mut attributes = vec![];
let text = self.value.clone();
let anchor = &range_to_anchor(range);
let length = text.len();

// Set the rule attributes based on the criteria.
let formula = match self.criteria {
Expand All @@ -2353,11 +2354,11 @@ impl ConditionalFormatText {
}
ConditionalFormatTextCriteria::BeginsWith => {
attributes.push(("type", "beginsWith".to_string()));
format!(r#"LEFT({anchor},1)="{text}""#)
format!(r#"LEFT({anchor},{length})="{text}""#)
}
ConditionalFormatTextCriteria::EndsWith => {
attributes.push(("type", "endsWith".to_string()));
format!(r#"RIGHT({anchor},1)="{text}""#)
format!(r#"RIGHT({anchor},{length})="{text}""#)
}
};

Expand Down
Loading

0 comments on commit a8274ed

Please sign in to comment.