I have a grid that consists of 1 band (multiple bands actually but only one is visible) that lists a persons name in one column and a nick name in a second column.
What I'm trying to do is to export the grid to a PDF where I only list the column headers one time per page instead of once per row.
I've looked at the various options for the grid band HeaderPlacement property but none of them sound like they give me what I want which is something similar to a MS Word table "Repeat header" as in
HEADER 1 HEADER 2
item a item bitem c item ditem e item f...__________________________________ PAGE BREAK
HEADER 1 HEADER 2etc.....
Is there a property that I'm just missing here.
I beleive the grid does this by default when there is only a single band. So it might be just be an issue with how you are going about hiding the child bands. What you should do is set the layout.ViewStyle to SingleBand. You could do this on the on-screen grid. Or you could do it on the Layout passed into the BeginExport method, if you don't want to affect the on-screen grid.
I'm pretty sure that will work, but if not, you might also want to set the HeaderPlacement property to FixedOnTop and see if that does it.
Mike,
Thanks for the reply. I tried setting the layout viewstyle property in the BeginExport event as you suggested
e.Layout.ViewStyle = ViewStyle.SingleBand;
but it did not make any difference. Since (per the docs) setting the HeaderPlacement property) has no effecdt if ViewStyle is singleband, I took that code out and tried just setting the placement, again no difference. I still get repeated column headers for the band and each row.
You said something about how I was hiding the bands. All I did here was to set the Hidden property on the band to true. Should I be doing simething different here?
Well again... I'm still not really clear on what behavior you are actually getting or what the problem is. So it's hard to say why that solves it.
I think I have it working "properly" now. What I had to do was to also set the UseRowLayout property on the band to false. That does not seem right to me (that I have to turn off the userowlayout property that is). So, the code
e.Layout.Bands[0].UseRowLayout = false;e.Layout.ViewStyle = ViewStyle.SingleBand;.... then code to set the column header visible position to get things in the right output order
seems to work for me. I think that having to set both of these properties to get the proper output is a defect but perhaps there is some rational here.
NeilLamka said:I tried setting the layout viewstyle property in the BeginExport event as you suggested e.Layout.ViewStyle = ViewStyle.SingleBand; but it did not make any difference. Since (per the docs) setting the HeaderPlacement property) has no effecdt if ViewStyle is singleband
I tried setting the layout viewstyle property in the BeginExport event as you suggested
but it did not make any difference. Since (per the docs) setting the HeaderPlacement property) has no effecdt if ViewStyle is singleband
I'm a little confused, though. You say you are getting band and column headers on every row? That doesn't make sense, unless you are using RowLayouts and LabelStyle is set to keep the headers with the cells.