Print issue with RadrichtextBox

10 posts, 1 answers
  1. Sekh
    Sekh avatar
    6 posts
    Member since:
    Oct 2013

    Posted 29 Oct 2013 Link to this post

    Hi ,
    I am using RadRichtextBox for print of RadGridView Data.Print is working but All the column in RadGridView  is not cmming.Its get cuts from end.
     My reqirement is when there is more column then those column should appear automatically in the next page consecutively or next document.

    Please find my attached document also.And please help me it is very urgent ..

    Thanks in advanced...
    Regards
    Rahman
  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 30 Oct 2013 Link to this post

    Hi Rahman,

    RadRichTextBox's native document - RadDocument, is built as flow document. The control only supports vertical pagination and we have no plans for horizontal pagination. You could try to work around the clipping of content with one of the following approaches:
    • Set the orientation of the document to landscape and the page size to a large size.
    • Measure the columns of the RadGridView in your application and create separate tables from small sets of columns. What you should be aware in this regard is that RadDocument's model does not allow consecutive tables, so you should make sure to add at least one empty paragraph between them.

    Additionally, I want to mention that we are currently considering exposing printing functionality for the RadSpreadsheet control which will allow splitting the document horizontally. Worksheets are not flow documents, so they can be paginated both vertically and horizontally. We will do our best to implement the functionality for the Q1 2014 release.

    Let us know if you have other comments or questions.

    Regards,
    Petya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Sekh
    Sekh avatar
    6 posts
    Member since:
    Oct 2013

    Posted 07 Nov 2013 Link to this post

    Hi Petya,
    Thanks for your reply..
    Could you please help me out on vertical pagination.How we can achieve the same thing what ever I have explain on my last post.

    Regards,
    Sekh
  5. Petya
    Admin
    Petya avatar
    975 posts

    Posted 11 Nov 2013 Link to this post

    Hello Sekh,

    The basic idea behind the suggested approach is as follows:
    • Measure the available horizontal space in a page (by default, A4 is the default page size.
      double availableWidth =this.radRichTextBox.Document.SectionDefaultPageSize.Width - this.radRichTextBox.Document.SectionDefaultPageMargin.Size.Width;
    • Start building a Table document element based on the RadGridView from its first row. You can measure the width of your grid view's columns and set it as width to the respective table cells.
      double totalWidth = 0;
      List<GridViewBoundColumnBase> columns = (from c in grid.Columns.OfType<GridViewBoundColumnBase>()
                                               orderby c.DisplayIndex
                                               select c).ToList();
      tableCell.PreferredWidth = new TableWidthUnit((float)columns[i].ActualWidth);
      totalWidth += columns[i].ActualWidth;
    • Once the available width is exceeded, stop building the first row and populate the columns enumerated in this table row by row until the end of the RadGridView.
      if(totalWidth >= availableWidth)
    • Repeat the first three steps until all data is exported.
    As I mentioned, Tables cannot be consecutive blocks in a RadDocument, so please make sure to separate them with empty paragraphs in the document.

    I hope this helps!

    Regards,
    Petya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Sekh
    Sekh avatar
    6 posts
    Member since:
    Oct 2013

    Posted 13 Nov 2013 Link to this post

    Hi Petya,
    Thanks for reply..
    I have tried your approached ,it is working.
    Now one more problem I need header in all of pages .For header I have implemented somethings some thing like this.

    Telerik.Windows.Documents.Model.Table table = null;
                Telerik.Windows.Documents.Model.Paragraph paragraph = new Telerik.Windows.Documents.Model.Paragraph();
                section.Blocks.Add(paragraph);
                // Display header logic
                Span hspan = new Span(Toolname);
                hspan.FontSize = 15;
                if (!string.IsNullOrEmpty(Toolname))
                    paragraph.Inlines.Add(hspan);

    Here Toolname is the header name.
    But in all page how I can achieve it ..Please help..

    Thanks & Regards,
    Sekh
  7. Answer
    Petya
    Admin
    Petya avatar
    975 posts

    Posted 13 Nov 2013 Link to this post

    Hi Sekh,

    RadDocument has its own concept of headers, so you can try placing the respective content in the section's header. You can check the documentation of the feature here.

    Let me know if you have further questions.

    Regards,
    Petya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  8. Sekh
    Sekh avatar
    6 posts
    Member since:
    Oct 2013

    Posted 15 Nov 2013 Link to this post

    Hi Patya,
    Your idea is working...I just added this type of logic..

    public RadDocument CreateDocumentForHeader()
            {
                RadDocument document = new RadDocument();
                Section section = new Section();
                Paragraph paragraph = new Paragraph();
                PageField pageField = new PageField() { DisplayMode = FieldDisplayMode.Result };
                paragraph.Inlines.Add(new Span(Toolname));
                paragraph.TextAlignment = RadTextAlignment.Left;
                section.Blocks.Add(paragraph);
                document.Sections.Add(section);
                return document;
            }
    Here ToolName is nothing but a header what I am going to display in header section.
    than i used this line of code at the time of creation of Document for print
     //Adding Header 
                document.Sections.First.Headers.Default = new Header() { Body = this.CreateDocumentForHeader() };

    Regards,
    Sekh
  9. Petya
    Admin
    Petya avatar
    975 posts

    Posted 15 Nov 2013 Link to this post

    Hello Sekh,

    I'm happy to hear you were able to implement the desired scenario! Should you have any other questions or feedback, do not hesitate to contact us again.

    Regards,
    Petya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  10. Sekh
    Sekh avatar
    6 posts
    Member since:
    Oct 2013

    Posted 18 Nov 2013 Link to this post

    Hi Patya,
    I need one more help.
    Is it possible to all GridColoum header should appear  in all pages.

    I am attaching the sample grid header.This will be included multiple pages.

    Regards,
    Rahman


  11. Petya
    Admin
    Petya avatar
    975 posts

    Posted 20 Nov 2013 Link to this post

    Hello Rahman,

    As explained in the article I previously referenced, headers and footers are applied on a per-section basis. Additionally, they can be linked to the header/footer of the previous section. Maybe you can link all headers and place the content you wish to be repeated in the header. The information based on your Toolname which you are currently placing there can be added in the main document.

    I hope this helps!

    Regards,
    Petya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WPF is Visual Studio 2017 Ready