We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

printing covered cells

I have a gridDataBoundGrid and when I format my grid I''m adding a covered range for a particular row: grid.Model.CoveredRanges.Add(GridRangeInfo.Cells(i,grid.Binder.NameToColIndex("Id"),i,grid.Model.ColCount)); where "i" is the index of a specific row. I''m also setting the style.BackColor to black for the first cell in the range. Visibly everything works/looks fine, the entire row is covered and black (and I can scroll and it looks fine), but when I attempt to print the grid (using the gridFitToPrint example as a guide), the row only prints black for the area visible on the screen before I attempt to print. The rest of the row is white. Everthing else is printing correctly. Thanks for any help you can provide. -Tyler

6 Replies

AD Administrator Syncfusion Team November 11, 2004 03:17 PM UTC

>>I''''m also setting the style.BackColor to black for the first cell in the range. How are you doing this? You cannot set the style of a particular cell in a GridDataBoundGrid, so you would have to use PrepareViewStyleInfo to try to handle this as described in this KB. Is this what you are doing? http://www.syncfusion.com/Support/article.aspx?id=560

TK Tyler Kohn November 11, 2004 03:48 PM UTC

yea, that''s what I''m doing, in the mygrid_PrepareViewStyleInfo method I''m setting the style. So if the cell is in the row I''m concerned with it sets the backcolor.

AD Administrator Syncfusion Team November 11, 2004 04:39 PM UTC

I kludged up that sample to work with a griddataboundgrid, it seems to be coloring the whole covered cell for me. Can you modify it to show the problem? CS_9977.zip

TK Tyler Kohn November 11, 2004 05:17 PM UTC

Ok, managed to do it. It turns out that if I hide the first column and span the covered range from the first (now hidden) column to the end the columns you can see this occur. I understand that you might not want to include a hidden cell in a covered range (not sure what other issues might appear). But do you know why this result occurs? Also, I noticed that if you scroll to the far right of the grid and do a print/print preview it only prints what is now currently visible. this occurs independantly of the first issue. Why is this and is how can be sure that the entire grid is printed? -tyler CS_8629.zip

AD Administrator Syncfusion Team November 11, 2004 10:47 PM UTC

I think probably the problem is that it is the top-left cell of teh covered range that is hidden. The grid takes its queues for drawing the covered range from the top-left cell. When that cell is hidden, it is never drawn which I think is what is cusing this problem. You should try adjusting your covered ranges so the top-left cell is not hidden. As far as the scrolling problem, the DrawGrid draws as much of the visible grid as will fit in the bounds. It does not necessary start at column 1. It stars with the first visible column. So, you should set LeftColIndex to make sure the part of the grid that you want draw is drawn in DrawGrid. his.gridControl1.GridBounds = new Rectangle(0, 0, gridWidth, gridHeight); this.gridControl1.LeftColIndex = 1; this.gridControl1.DrawGrid(g); this.gridControl1.ResetGridBounds();

TK Tyler Kohn November 12, 2004 10:29 AM UTC

thanks, I made both changes and it looks good.

Live Chat Icon For mobile
Up arrow icon