Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
305
Print DataGrid with a Report, problem with row Height
posted

Hi,

I generate a report from a DataGrid, where each row on the windows form is display as we wan't.

private void gridAEA_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
        {
            e.Layout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns;
            e.Layout.Override.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.AutoFree;
            e.Layout.Override.RowSizingArea = RowSizingArea.EntireRow;
            e.Layout.Override.CellMultiLine = Infragistics.Win.DefaultableBoolean.True;

...

}

If the cell width is smaller than the text inside, it's display on several rows.

But, when we print the report using his print method, the data in cells are not all dispaly. It is on display multiLine only if the largest cells have data on several lines (like it's explain on the propertie : Infragistics.Win.UltraWinGrid.RowSizing.AutoFree).

Why is it display as we wan't on the DataGrid (in the WinForm) and not when we print ?

Do you have a solution to print the Report (from datagrid) as we wan't ? It seems that the row adapt itself if one of it cells is display on multiLine.

Best Regards,

Denis

Parents
  • 467430
    Offline posted

    Hi Denis,

    When you print the grid, it's going to print using the same sizes for columns and rows that the on-screen grid has. The problem with this is that the printer uses different units (points instead of pixels), so things don't always come out exactly right.

    I'm having a little trouble understanding the behavior you want, but it seems to me like you need to autosize the printed rows.

    What you could do is place code in the InitializeRow event of the grid and check e.Row.Band.Layout.IsPrintLayout. This will tell you if the row is a print row or an on-screen row. If it's a print row, you can call PerformAutoSize on the row and it will size the row based on the printer units.

    You could do the same thing with the columns inside InitializePrint or InitializePrintPreview - if the colmun widths are a problem.

Reply Children
No Data