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.
Unfortunately, activation email could not send to your email. Please try again.

Problem printing with floating cells and no column headers

Thread ID:

Created:

Updated:

Platform:

Replies:

59572 Apr 17,2007 11:49 AM May 8,2007 06:15 AM Windows Forms 4
loading
Tags: GridControl
Giles Thomas
Asked On April 17, 2007 11:49 AM

Hi,

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 4.4.0.51
.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.


Regards,

Giles


GridFloatIssueRepro.zip

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

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)
{
return;
}
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;
}
printDocument.Print();
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 07:57 AM

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


Regards,

Giles

Administrator [Syncfusion]
Replied On April 18, 2007 10:06 AM

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.

Anonymous
Replied On May 8, 2007 06:15 AM

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?

Thanks
William

CONFIRMATION

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.

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.

;