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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem printing with floating cells and no column headers

Thread ID:





59572 Apr 17,2007 03:49 PM UTC May 8,2007 10:15 AM UTC WinForms 4
Tags: GridControl
Giles Thomas
Asked On April 17, 2007 03:49 PM UTC


We've found what looks to us like a bug: when printing column headers is switched off, then the FloatCellsMode property appears to be ignored when you print. The behaviour on the screen is fine.

Product version: Essential Grid
.NET 2.0

In the attached repro project, there is a grid with the FloatCellsMode property set to BeforeDisplayCalculation, and with cell A1 containing a long string that floats - as you would expect - over the other cells in row 1. There is also a checkbox to switch printing column headers on and off, which is initially on, and there is a button to print the grid.

If you hit the print button with the settings as it stands when the project starts up, then on the printed page you get column headers, and the text in cell A1 floats across the rest of the row on the printed page - in other words, everything is fine. However, if you switch off the FloatCellsMode property using the checkbox, and then print, you will see that the text in cell A1 no longer floats *on the printout* - it still looks fine on the screen.

Is this a bug? If so, is there a workaround?

Please note - this issue is separate from and in addition to the problems I am having sorting out the alignment of the grid when printing.




Administrator [Syncfusion]
Replied On April 17, 2007 06:30 PM UTC

I think you can work around this problem until we get it fixed by setting the rowheight to zero instead of using that property. Usingan event to set the rowheight can avoid seeing the onscreen grid change as you print the grid.

Here is some code.

private void button1_Click(object sender, EventArgs e)
PrintDialog printDialog = new PrintDialog();
if (printDialog.ShowDialog() != DialogResult.OK)
GridPrintDocument printDocument = new GridPrintDocument(this.gridControl1);
printDocument.PrinterSettings = printDialog.PrinterSettings;
bool hideRow = false;
if (!this.gridControl1.Properties.PrintColHeader)
this.gridControl1.Properties.PrintColHeader = true;
this.gridControl1.QueryRowHeight += new GridRowColSizeEventHandler(gridControl1_QueryRowHeight);
hideRow = true;
if (hideRow)
this.gridControl1.Properties.PrintColHeader = false;
this.gridControl1.QueryRowHeight += new GridRowColSizeEventHandler(gridControl1_QueryRowHeight);
hideRow = false;

void gridControl1_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
if (gridControl1.PrintingMode && e.Index == 0)
e.Size = 0;
e.Handled = true;

Giles Thomas
Replied On April 18, 2007 11:57 AM UTC

Thank you, Clay - I'll give that a go, and will post back if I cannot get it to work.



Administrator [Syncfusion]
Replied On April 18, 2007 02:06 PM UTC

Just noticed a typo in the code I posted. The last occurrence of

this.gridControl1.QueryRowHeight += new GridRowColSizeEventHandler(gridControl1_QueryRowHeight);

should be

this.gridControl1.QueryRowHeight -= new GridRowColSizeEventHandler(gridControl1_QueryRowHeight);

to unsubscribe to the event.

Replied On May 8, 2007 10:15 AM UTC

Thanks for the workaround above Clay; we've implemented it and it works in most cases.

However, it does not allow text to float beyond the edge of the grid -- if you have a 1x1 grid containing a long string, the string will still be truncated on print.

Do you have any suggestions for working round this issue?



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon