Page break using Print Helper extension of windows-community-toolkit #4004
Replies: 10 comments
-
Hello RaoHammas, thank you for your interest in Windows Community Toolkit! I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible.. Other community members may also answer the question and provide feedback 🙌 |
Beta Was this translation helpful? Give feedback.
-
Thanks for highlighting this and it's a great question. Let's see if our devs are aware of this and if there is any option we have to automatically adjust a large amount of data. |
Beta Was this translation helpful? Give feedback.
-
@RaoHammas by default the control breaks pages by child framework element, so the grid itself is being only added to a single page I believe. I think the original intent was that the developer would still be in charge of creating pages for more complex scenarios. See the example in our docs for "Print a list with each item on a separate page with static header and page number". I'm not sure how easy/possible it'd be for the helper to have more helpers for this type of scenario, I'm not too familiar with this code. Wondering if @avknaidu, @deanchalk, and @XamlBrewer have any thoughts/ideas here? |
Beta Was this translation helpful? Give feedback.
-
I know. That's why example includes looping. So on each iteration a new framework element is added and that takes one page. But this logic is incomplete and false. As i mentioned as user have no control on it because if my grid rows are more in number ? And let's say i decide that I'll print only 12 rows on each page ..still if a cell element is large ..in that case logic will break because row will take extra space and some data will not be printed. |
Beta Was this translation helpful? Give feedback.
-
@RaoHammas the logic you are stating makes sense. Let's see what the team mentioned above have to say regarding the actual code. |
Beta Was this translation helpful? Give feedback.
-
Not sure the Print helper can do this, but you need your main control to be a RichTextBlock and generate Paragraphs for the items. More details here: https://xamlbrewer.wordpress.com/2016/10/25/a-recipe-for-printing-in-uwp-mvvm-apps/ . |
Beta Was this translation helpful? Give feedback.
-
It seems to me that this issue could be because your data control (CompanyDetailReportTemplateControl) is virtualised, or inside a ScrollViewer. You have the first row control (header) in the print and the third row control (footer) in the print, but the central datagrid is sized to the remaining space - but it there's not enough so maybe its virtualising or clipping ? which is the correct behaviour in a view, but maybe you need to switch of virtualising so the data control will span pages for printing. It means you'll loose the footer (it will not work) but you may get the data printed the way you want. |
Beta Was this translation helpful? Give feedback.
-
@deanchalk no sir, it's not because of virtualization. i think there is no automatic page adding mechanism. So that if data is large and need to overflow page then it should automatically add a new page and shift remaining data to that page. But it doesn't happen. |
Beta Was this translation helpful? Give feedback.
-
any progress on this ? |
Beta Was this translation helpful? Give feedback.
-
Moving this to Discussions for further clarity on this issue. |
Beta Was this translation helpful? Give feedback.
-
I'm using
PrintHelper
extension ofwindows-community-toolkit
and printing some data. The problem is when data is large it overlaps the page and i can't find a way to dynamically add a new page and shift data to next page. Is there a way ?The result looks like this. As can be seen if data is large it is not printed because next page is not added automatically. I can do that be manually looping data and defining exactly how many rows to print on one page and how many on next but that's not what i want cuz if some cell data is large then my logic won't work.
Beta Was this translation helpful? Give feedback.
All reactions