This is a migrated thread and some comments may be shown as answers.

Print issue with RadrichtextBox

9 Answers 98 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Sekh
Top achievements
Rank 1
Sekh asked on 29 Oct 2013, 12:11 PM
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

9 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 30 Oct 2013, 04:33 PM
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 >>
0
Sekh
Top achievements
Rank 1
answered on 07 Nov 2013, 01:55 PM
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
0
Petya
Telerik team
answered on 11 Nov 2013, 05:07 PM
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 >>
0
Sekh
Top achievements
Rank 1
answered on 13 Nov 2013, 09:53 AM
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
0
Accepted
Petya
Telerik team
answered on 13 Nov 2013, 05:32 PM
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 >>
0
Sekh
Top achievements
Rank 1
answered on 15 Nov 2013, 12:23 PM
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
0
Petya
Telerik team
answered on 15 Nov 2013, 02:32 PM
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 >>
0
Sekh
Top achievements
Rank 1
answered on 18 Nov 2013, 11:11 AM
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


0
Petya
Telerik team
answered on 20 Nov 2013, 05:07 PM
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 >>
Tags
RichTextBox
Asked by
Sekh
Top achievements
Rank 1
Answers by
Petya
Telerik team
Sekh
Top achievements
Rank 1
Share this question
or