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;
10 Answers, 1 is accepted
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
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
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
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
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
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
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.
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
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
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
Hello Adrian,
We do our best to fix all bugs, yet some receive less attention than others, which is why they can sometimes be delayed, such as this one. As much as I'd like to share an ETA on its resolution, currently, none is available, so I would not want to mislead you. Please note that there is a project with a workaround attached to the item details. Is there anything that prevents you from using it?
Please accept our apologies for this delay!