Problem printing with floating cells and no column headers
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
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
SIGN IN To post a reply.
4 Replies
AD
Administrator
Syncfusion Team
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.
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;
}
}
GT
Giles Thomas
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.
Regards,
Giles
Regards,
Giles
AD
Administrator
Syncfusion Team
April 18, 2007 02:06 PM UTC
Just noticed a typo in the code I posted. The last occurrence of
should be
to unsubscribe to the event.
this.gridControl1.QueryRowHeight += new GridRowColSizeEventHandler(gridControl1_QueryRowHeight);
should be
this.gridControl1.QueryRowHeight -= new GridRowColSizeEventHandler(gridControl1_QueryRowHeight);
to unsubscribe to the event.
AN
Anonymous
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?
Thanks
William
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
SIGN IN To post a reply.
- 4 Replies
- 3 Participants
-
GT Giles Thomas
- Apr 17, 2007 03:49 PM UTC
- May 8, 2007 10:15 AM UTC