Is there any way to programmatically hide layers in a report?
I have a report that needs to be visible on screen in its entirety, but when printed it should only print the data, as the report layout will be pre-printed onto carbon-copy paper.
Unfortunately it seems that the isVisible property doesn’t apply to layers.
You can’t hide the layers in a report with code, but you could just make a second report that’s bound to the datasets of the first and add a print button to the screen that prints the hidden one.
Using the isVisible property on all the individual elements within the ‘hidden’ layer seems to work. Fortunately it is possible to select multiple elements and set the isVisible property for all of them at once. This allows the same report to be used for both cases, which is a big advantage.
(Note: Layers have no functional difference, they are only a convenience to make selection/viewing easier within the report designer)