AppendConditions
(
StringBuilder oDynamicFilterConditions,
String sColumnName,
String sSelectedMinimumAddress,
String sSelectedMaximumAddress
)
{
Debug.Assert(oDynamicFilterConditions != null);
Debug.Assert( !String.IsNullOrEmpty(sColumnName) );
Debug.Assert( !String.IsNullOrEmpty(sSelectedMinimumAddress) );
Debug.Assert( !String.IsNullOrEmpty(sSelectedMaximumAddress) );
AssertValid();
// Sample appended conditions, if non-numeric cells should be filtered:
//
// [ColumnName1] >= Misc!$P$2,
// [ColumnName1] <= Misc!$Q$2,
//
// Sample appended conditions, if non-numeric cells should not be
// filtered:
//
// OR(NOT(ISNUMBER([ColumnName1])), [ColumnName1] >= Misc!$P$2),
// OR(NOT(ISNUMBER([ColumnName1])), [ColumnName1] <= Misc!$Q$2),
String sFormatString;
if (chkDoNotFilterNonNumericCells.Checked)
{
sFormatString =
"OR(NOT(ISNUMBER([{0}])), [{0}] >= {1}!{2}),"
+ " OR(NOT(ISNUMBER([{0}])), [{0}] <= {1}!{3}),"
;
}
else
{
sFormatString =
"[{0}] >= {1}!{2},"
+ " [{0}] <= {1}!{3},"
;
}
oDynamicFilterConditions.AppendFormat(
sFormatString,
EscapeColumnName(sColumnName),
WorksheetNames.Miscellaneous,
sSelectedMinimumAddress,
sSelectedMaximumAddress
);
}