I am trying to add a grid to a section header and it isn't working. The closes I have gotten is seeing part of the date, it is either being cut off by the band which fills up the section, or it goes too high on the page and the top is cut off by something, though there is still space. Here is my code:
section.PageMargins.All = 40; ISectionHeader header = section.AddHeader(); IGrid headerGrid = header.AddGrid(0, -18); IGridColumn column = headerGrid.AddColumn(); column.Width = new RelativeWidth(50); column = headerGrid.AddColumn(); column.Width = new RelativeWidth(30); column = headerGrid.AddColumn(); column.Width = new RelativeWidth(20); IGridRow row = headerGrid.AddRow(); row.AddCell().AddQuickText("Resident: " + resAsmtDoc.ResAssessment.ResidentId.ToString()); row.AddCell().AddQuickText("Identifier: " + resAsmtDoc.ResAssessment.ResidentId.ToString()); row.AddCell().AddQuickText("Date: " + resAsmtDoc.ResAssessment.AssessmentDate.ToString("d"));
Hi,
It's hard to tell from a code snippet, but I don't see anything here that sets the Height on the Header. I think you might need to determine the height of the grid yourself and set the height of the header to match. Or maybe set the height on the header to AutoHeight.
Mike,
I am not setting a height to the header, so I am sure that is the issue. I would like to use the AutoHeight, but I am not seeing an example of how AutoHeight is used in the "Infragistics Documents Samples Gallery" code sample. Any suggestions on how to use it?
Sam
Hi Sam,
I'm not sure AutoHeight will work. It never seems to do what I expect it to, but I suspect it's just a lack of understanding on my part about what's it's supposed to be doing. But basically, you would do this:
grid.Header.Height = Infragistics.Documents.Report.AutoHeight.Instance;
What a wonderful reply. Nice to know I am not the only one in the dark here ;)
I did try what you suggested, prior to asking for an example and what I found is that the AutoHeight is a class and the grid.Header.Height is a float. They don't seem to work very well together.
Might I ask that you talk to the developers to confirm whether or not AutoHeight is the correct way to go, and if so, how to use it. I would much appreciate it!
We are not talking about the same thing, I was referring to the section.header object. Since the header had a negative offset, I set it's height to the positive value of the offset and that seems to work.
Are we talking about the same thing? I was referring to the Height on the IGrid.Header. It's not a float, it's a Height object.