Current filter:
                                You should refresh the page.
                                  • Hi,
                                    I’m trying to print a TableView and I have some problem with headers and footers. My grid has many columns and doesn’t fit nicely to a single page. So I use link.VerticalContentSplitting = VerticalContentSplitting.Smart; to have the grid arranging the column on two pages.
                                    The header and footer are bound to UsablePageWidth but in this case it is incorrect and I don’t know how to fix it.

                                    This happens also if I use the scale button on the Print Preview.
                                    I have modified a sample to show this behavior.

                                    Any suggestion?

                                    Thanks,
                                    Fabrizio

                                1 Solution

                                Creation Date Importance Sort by

                                Hi Fabrizio,
                                Thank you for the sample project. The "Smart" vertical content splitting does not work here as columns are not aligned with elements that you add to the PageHeader / PageFooter area. As it is impossible to move a column to the next page without cutting that extra element in half (the opposite is true as well), the original layout remains. As for the UsablePageWidth property, it returns the width of a single page excluding side margins, not the width of the printed grid. The only workaround I can suggest here is to apply your templates to the document's top/bottom margin area.

                                If that does not meet your goal, or if you'd like to get ultimate control over the print output, I suggest that you produce it with the help of our reporting tools (converted by your subscription). If that's something you've never had to deal before, please check our help documentation: Get Started with DevExpress Reporting. Naturally, reporting is a separate product which is different from the GridControl's built-in printing engine. Lucky, it is not necessary to create the same tabular report (Create a Table Report) from scratch as there is a generator available: Grid-Based Report Generation.

                                Please try it and let us know how it works for you.

                                Regards,
                                Yaroslav

                                • Fabrizio Fabbri 08.26.2019

                                  Hi Yaroslav,
                                  This is not clear to me: The only workaround I can suggest here is to apply your templates to the document's top/bottom margin area.

                                  We are using XtraReport building reports by code. In this case I was serching for a quicker solution. We have a lot of "secondary" grids to print like the one in the example. I'm just searching a way to have the header and footer aligned with the grid (or the page).
                                  Thanks,
                                  Fabrizio

                                • Yaroslav (DevExpress Support) 08.26.2019

                                  >>The only workaround I can suggest here is to apply your templates to the document's top/bottom margin area
                                  Consider the following code:

                                  [C#]
                                  link.TopMarginTemplate = PrintingTemplates.PageHeaderTemplate; link.TopMarginData = new MyViewModel();

                                  >>I'm just searching a way to have the header and footer aligned with the grid (or the page).
                                  The built-in printing engine of our WPF DataGrid does not provide any option to align the content you add with any of its columns. That's why I mentioned reporting as a valuable alternative, especially provided that there is a ready-to-use report generator available.

                                  Regards,
                                  Yaroslav

                                • Fabrizio Fabbri 08.26.2019

                                  Hi Yaroslav,
                                  I've got it.
                                  Many thanks,
                                  Fabrizio