I'm using the Report.References collection to link to some external
Assemblies (developed in C#). Also, I use the Report.Classes collection to
instantiate some classes defined in that assemblies. This works, as I'm
able to show a custom Windows form from the constructors of the instantiated
classes in report initialization time and to get simple values from some
properties. As this approach is extremately useful, I'd like to acquire
maximum flexibility being able to access from these classes to all the
properties of the Report via the corresponding namespaces as follows:
Microsoft.ReportingServices.ReportProcessing
Microsoft.ReportingServices.ReportRendering
As an example, I'd like to access to the Report object, to an existing
Matrix item, etc. I'm trying it this way:
///////////////////////////// C# in the Assembly:
namespace CustomAssembly
{
public class Class1
{
public int
GetRenderedColumnsCount(Microsoft.ReportingServices.ReportRendering.Report
p_Report)
{
return p_Report.Columns;
}
public int
GetMatrixColumnsCount(Microsoft.ReportingServices.ReportRendering.Matrix
p_Matrix)
{
return p_Matrix.Columns;
}
}
}
/////////////////////////////// Report:
First, I reference the Assemblies:
<CodeModules>
<CodeModule>CustomAssembly, Version=1.0.1719.22270, Culture=neutral,
PublicKeyToken=null</CodeModule>
</CodeModules>
Second, I instantiate the Classes:
<Classes>
<Class>
<ClassName>CustomAssembly.Class1</ClassName>
<InstanceName>class1</InstanceName>
</Class>
</Classes>
Last, I tried to use the following expressions in a TextBox.Value but none
of them work:
=Code.class1.GetRenderedColumnsCount(Report)
=Code.class1.GetRenderedColumnsCount(Code.Report)
=Code.class1.GetMatrixColumnsCount(matrix1)
=Code.class1.GetMatrixColumnsCount(Report.matrix1)
=Code.class1.GetMatrixColumnsCount(Report!matrix1)
=Code.class1.GetMatrixColumnsCount(Report("matrix1"))
I'm sure the construction works because I'm showing a MessageBox in the
constructor and other properties are returning the proper value to the
report.
Can anyone, please, tell me what am I doing wrong?