Header Problems

3 posts, 0 answers
  1. Steve
    Steve avatar
    127 posts
    Member since:
    Jun 2011

    Posted 27 Jul 2012 Link to this post

    I'm having problems with the header on my RadDocument.  I've attached an image of what is occurring.  The header has two paragraphs, the first showing the page fields and the second spans mimicking column headers for the table in the document.  The first time the document is displayed, the content for the two paragraphs is switched.  After paging, it is corrected.  The switch will also come back if I maximize the window.  Below is the code that creates the header document....
    private RadDocument CreateHeaderDocument(List<GridViewBoundColumnBase> columns)
        RadDocument document = new RadDocument();
        Section section = new Section();
        Paragraph paragraph = new Paragraph();
        paragraph.FontSize = fontSize;
        PageField pageField = new PageField()
            DisplayMode = FieldDisplayMode.Result
        FieldRangeStart pageFieldStart = new FieldRangeStart();
        pageFieldStart.Field = pageField;
        FieldRangeEnd pageFieldEnd = new FieldRangeEnd();
        pageFieldEnd.Start = pageFieldStart;
        FieldRangeStart numPagesFieldStart = new FieldRangeStart();
        numPagesFieldStart.Field = new NumPagesField()
            DisplayMode = FieldDisplayMode.Result
        FieldRangeEnd numPagesFieldEnd = new FieldRangeEnd();
        numPagesFieldEnd.Start = numPagesFieldStart;
        var ofSpan = new Span(" of ");
        ofSpan.FontFamily = fontFamily;
        ofSpan.FontSize = fontSize;
        ofSpan.FontWeight = FontWeights.Bold;
        ofSpan.ForeColor = Color.FromArgb(255, 0, 0, 0);
        var hdrPara = new Telerik.Windows.Documents.Model.Paragraph();
        hdrPara.Background = _headerBackground;
        var spaceWidth = GetScreenSize("i", fontFamily, fontSize, FontWeights.Bold, FontStyles.Normal, FontStretches.Normal).Width;
        foreach (GridViewBoundColumnBase col in columns)
            String s = String.Empty;
            if (col.Header != null)
                s = col.Header as String;
            var span = new Telerik.Windows.Documents.Model.Span(s);
            span.FontFamily = fontFamily;
            span.FontSize = fontSize;
            span.FontWeight = FontWeights.Bold;
            span.ForeColor = Color.FromArgb(255, 0, 0, 0);
            var hdrWidth = GetScreenSize(span.Text, span.FontFamily, span.FontSize, span.FontWeight, FontStyles.Normal, FontStretches.Normal).Width;
            var spaces = (col.ActualWidth - hdrWidth) / spaceWidth;
            for (int i = 0; i < spaces; i++)
                span.Text += " ";
        return document;

    Please advise, as this is definitely a show stopper,

    P.S. I also am curious as to why all the text in the header is gray; even when explictly setting the color to black. 

  2. Steve
    Steve avatar
    127 posts
    Member since:
    Jun 2011

    Posted 03 Aug 2012 Link to this post

    Any ideas on this? 
  3. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 06 Aug 2012 Link to this post

     Hi Steve,

    Thank you for reporting the layout issue in the header. This seems to be a bug. We have logged it for revision and will try to address it soon. We have updated your Telerik points in appreciation of this report. 

    As for the color of the text, it is black. It looks a bit lighter because there is an overlay which is added to the non-active parts of the editor, similarly to how this happens in Word. When you edit the main document, the overlay is shown over the headers and footers and vice versa.

    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top