Error when creating header with RadFlowDocument

1 Answer 58 Views
PdfProcessing
Steffen
Top achievements
Rank 1
Iron
Steffen asked on 26 Oct 2022, 07:48 AM | edited on 27 Oct 2022, 06:01 AM

Hi Telerik.

Attempting to create a Header with your documentation. Link: Headers and Footers

The example code writes: 

RadFlowDocument document = new RadFlowDocument(); 
document.Sections.AddSection(); 
 
document.Sections.First().Headers.Add(); // Creates the default Header. 
document.Sections.First().Headers.Add(HeaderFooterType.First); 
document.Sections.First().Headers.Add(HeaderFooterType.Even); 

However I get the errorcode:


'object' does not contain a definition for'Headers'and no accessible extension method 'Headers' accepting a first argument of type
 'object'could be found (are you missing a using directive or an assembly reference?) 

Am I doing something wrong?

 

 

Dimitar
Telerik team
commented on 28 Oct 2022, 08:50 AM

Hi Stefan, 

I am glad that you have a solution now.

I have tested the code from your post and the documentation and all works as expected on my side. Would it be possible to share the exact line where the exception occurs? 

I am looking forward to your reply.

1 Answer, 1 is accepted

Sort by
0
Accepted
Steffen
Top achievements
Rank 1
Iron
answered on 27 Oct 2022, 06:15 AM | edited on 27 Oct 2022, 06:43 AM

Section section = document.Sections.AddSection();
Header header = section.Headers.Add();
Found a solution myself. Rather disappointed with the documentation.
Tags
PdfProcessing
Asked by
Steffen
Top achievements
Rank 1
Iron
Answers by
Steffen
Top achievements
Rank 1
Iron
Share this question
or