[TotalPages#] is a deferred string macro substitution (if you subtract one directly from it [[TotalPages#] - 1], the engine will throw an InvalidCastException: Unable to cast System.String to Int32).
Use the numeric variable [TotalPages] (without the #) and be sure to enable double pass (DoublePass = true):
[[TotalPages] - 1]
(Or [Report.Engine.TotalPages - 1] but in any case, with DoublePass = true)
Comments
Hello!
[TotalPages#] is a deferred string macro substitution (if you subtract one directly from it [[TotalPages#] - 1], the engine will throw an InvalidCastException: Unable to cast System.String to Int32).
Use the numeric variable [TotalPages] (without the #) and be sure to enable double pass (DoublePass = true):
[[TotalPages] - 1](Or [Report.Engine.TotalPages - 1] but in any case, with DoublePass = true)