Repeat Header not working

11 posts, 0 answers
  1. Khawar
    Khawar avatar
    12 posts
    Member since:
    Jan 2018

    Posted 03 Apr 2019 Link to this post

    Hi,

    I have a problem where I need a header repeat on every page but its not working. Please help.

     

    RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
    Stream stream = File.Open(pathlogo, FileMode.Open);

    using (stream)
    {
        Telerik.Windows.Documents.Media.ImageSource image = newTelerik.Windows.Documents.Media.ImageSource(stream, "png");
        editor.InsertImageInline(stream, "png", new System.Windows.Size(168, 48));
    }

    var codeFont = new ThemableFontFamily(new System.Windows.Media.FontFamily("Arial"));
    editor.CharacterFormatting.FontFamily.LocalValue = codeFont;
    editor.CharacterFormatting.FontWeight.LocalValue = FontWeights.Bold;
    editor.CharacterFormatting.FontSize.LocalValue = 12.0;
    editor.InsertText("Statement");
    document.StyleRepository.AddBuiltInStyle(BuiltInStyleNames.TableGridStyleId);
    editor.TableFormatting.StyleId = BuiltInStyleNames.TableGridStyleId;

    var section = editor.InsertSection();
    var table = section.Blocks.AddTable();
    section.Rotate(PageOrientation.Landscape);
    var headerrow = table.Rows.AddTableRow();
    headerrow.RepeatOnEveryPage = true;
    var hcell1 = headerrow.Cells.AddTableCell();

    hcell1.Blocks.AddParagraph().Inlines.AddRun("Name").FontWeight = FontWeights.Bold;
    var hcell2 = headerrow.Cells.AddTableCell();
    hcell2.Blocks.AddParagraph().Inlines.AddRun("Profession").FontWeight = FontWeights.Bold;
    var hcell3 = headerrow.Cells.AddTableCell();
    hcell3.Blocks.AddParagraph().Inlines.AddRun("Age").FontWeight = FontWeights.Bold;

    foreach (var item in initltr)
    {
        var row = table.Rows.AddTableRow();
        var cell1 = row.Cells.AddTableCell();
        var cell2 = row.Cells.AddTableCell();
        var cell3 = row.Cells.AddTableCell();
        cell1.Blocks.AddParagraph().Inlines.AddRun(item.Name).FontSize = 9;
        cell2.Blocks.AddParagraph().Inlines.AddRun(item.Profession).FontSize = 9;
        cell3.Blocks.AddParagraph().Inlines.AddRun(item.Age).FontSize = 9;
    }

    return document;

  2. Georgi
    Admin
    Georgi avatar
    49 posts

    Posted 08 Apr 2019 Link to this post

    Hello Khawar,

    The property is supported when exporting a document using the DocxFormatProvider. However, the PdfFormatProvider class doesn't support, hence respect this property. We have logged a task to implement the functionality for the PDF export as well and I added an additional vote for this task on your behalf to increase its priority. You can subscribe to receive notifications about status changes using the related public item: Add support for the RepeatOnEveryPage property of TableRow in PDF export. The approach we can suggest as a workaround for this missing functionality is described in the public item and is related to drawing the tables using the API of the PdfProcessing library.

    I hope this helps.

    Regards,
    Georgi
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Khawar
    Khawar avatar
    12 posts
    Member since:
    Jan 2018

    Posted 08 Apr 2019 in reply to Georgi Link to this post

    Hi Georgi,

    If you look at the code, Its not exported to document or pdf yet. I m using radflowdocument passing as a parameter in method mentioned above. I was able to repeat header before but when I add section to change page orientation, it stopped working.

    Your help is greatly appreciated.

    Thanks

  4. Georgi
    Admin
    Georgi avatar
    49 posts

    Posted 11 Apr 2019 Link to this post

    Hi Khawar,

    I have tested the provided code and the repeat header functionality is working when the document is exported to a DOCX format. Since the RepeatOnEveryPage property is not supported when exporting to PDF, I mentioned the feature request related to the PdfFormatProvider class. Please, find attached a sample project demonstrating the approach of repeating table header row with export to a DOCX format using the code you have provided. 

    Can you please share more details on the scenario you are encountering? What is the format of the exported RadFlowDocument? What exactly you see is not working? You are saying that the document is still not exported at this point, so I am not sure I completely understand the scenario and would like to gather more information, so I can better assist you. I will appreciate any additional information you can share on the matter.

    Regards,
    Georgi
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Khawar
    Khawar avatar
    12 posts
    Member since:
    Jan 2018

    Posted 11 Apr 2019 in reply to Georgi Link to this post

    Hi Georgi,

    Repeater header is working in DOCX before conversion to PDF. I have tested and verified your previous response. I m creating a document using RADFlowDocument and then convert to DOCX and then PDF. When I checked DOCX, it has repeating headers but in PDF it didn't. As you mentioned earlier, this feature needs to be added in PdfFormatProvider library.

    Thanks for your quick response. Much appreciated.

    Khawar

  6. Michael
    Michael avatar
    1 posts
    Member since:
    Jul 2019

    Posted 24 Jul 2019 Link to this post

    Hello Georgi,

    I am evaluating a trial version of Telerik UI for ASP.NET MVC and require this feature.  If possible, please give it another up vote to increase the priority.

    Thank you, Michael

  7. Tanya
    Admin
    Tanya avatar
    877 posts

    Posted 25 Jul 2019 Link to this post

    Hi Michael,

    You can cast your vote for the implementation of the task using the Like button of the public item: WordsProcessing: Add support for the RepeatOnEveryPage property of TableRow in PDF export. If you would like to receive updates about status changes, you can subscribe by clicking the Follow button.

    Regards,
    Tanya
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  8. Khawar
    Khawar avatar
    12 posts
    Member since:
    Jan 2018

    Posted 20 Nov 2019 in reply to Georgi Link to this post

    Hi,

    Any update on repeating header in PDF document yet? Last, I was told it might be available soon in next release or so. Please advise.

  9. Dimitar
    Admin
    Dimitar avatar
    2841 posts

    Posted 25 Nov 2019 Link to this post

    Hi Khawar,

    The planning for the next release has been made and unfortunately, this is not included there. Currently, I cannot say when this task will be scheduled for implementation.  I would recommend hitting the follow button on the item page. This way you will be notified when its status changes. 

    In addition, I wanted to ask from where you have the information that this will be implemented?

    Thank you for your understanding.

    Regards,
    Dimitar
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  10. Khawar
    Khawar avatar
    12 posts
    Member since:
    Jan 2018

    Posted 25 Nov 2019 in reply to Dimitar Link to this post

    Hi Dimitar. 

    Here is the reply from admin who helped me for this matter.

    Hello Khawar,

    The property is supported when exporting a document using the DocxFormatProvider. However, the PdfFormatProvider class doesn't support, hence respect this property. We have logged a task to implement the functionality for the PDF export as well and I added an additional vote for this task on your behalf to increase its priority. You can subscribe to receive notifications about status changes using the related public item: Add support for the RepeatOnEveryPage property of TableRow in PDF export. The approach we can suggest as a workaround for this missing functionality is described in the public item and is related to drawing the tables using the API of the PdfProcessing library.

    I hope this helps.

    Regards,
    Georgi
    Progress Telerik

  11. Dimitar
    Admin
    Dimitar avatar
    2841 posts

    Posted 26 Nov 2019 Link to this post

    Hello Khawar,

    Thank you for sharing this. My colleague's post does not promise a specific release or a date for the issues resolving. In general, the issue priority depends on many things and each feature or issue is carefully tested before released. If you are following the item you will be notified when its status is changed. 

    In addition, I noticed that there is a workaround available. In your case, I believe it would be better to use the approach suggested in the item itself and create a FixedDcument directly. In the PDF model, the tables are represented by lines and text, and once the document is exported you cannot get the table as an object and modify it. The RepeatOnEveryPage property is exported and is then used by RadRichTextBox or Word when the document is rendered. There is no logic in the WordsProcessing library that determines where the table is split and the new page begins. 

    I hope this helps. Please let me know if you have additional questions.

    Regards,
    Dimitar
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top