How to change the "Repeat Group Header On Each Page" option of the Crystal Report group via C# code?

StackOverflow https://stackoverflow.com/questions/21467531

  •  05-10-2022
  •  | 
  •  

Question

I am making a report in which I used the group to repeat the header of my grid. I made a group by one unique field and checked the option "Repeat Group Header On Each Page" which is good when I generate PDF, but when I generate Excel doc, that repeated header shows up in the middle of the table, so I need to change that in case I want to make an excel file.

Since I know how to access some formula in the report, maybe that can help to.

So, does anyone knows how to solve this?

Thank you.

Was it helpful?

Solution

There is a function called: InRepeatedGroupHeader. If I apply formula to the Suppress option of the group in which header is defined and then in the code change it, it works.

var formulaField = mainSubreport.DataDefinition.FormulaFields["RepeatHeader"];
formulaField.Text = "if inrepeatedgroupheader then TRUE ELSE FALSE";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top