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

Header Problems

2 Answers 105 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 27 Jul 2012, 09:29 PM
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;
    paragraph.Inlines.Add(pageFieldStart);
    paragraph.Inlines.Add(pageFieldEnd);
    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);
    paragraph.Inlines.Add(ofSpan);
    paragraph.Inlines.Add(numPagesFieldStart);
    paragraph.Inlines.Add(numPagesFieldEnd);
    section.Blocks.Add(paragraph);
    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 += " ";
        }
        hdrPara.Inlines.Add(span);
    }
    section.Blocks.Add(hdrPara);
    document.Sections.Add(section);
    return document;
}

Please advise, as this is definitely a show stopper,
Thanks,
Steve



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 Answers, 1 is accepted

Sort by
0
Steve
Top achievements
Rank 1
answered on 03 Aug 2012, 06:39 PM
Any ideas on this? 
Thanks,
Steve
0
Iva Toteva
Telerik team
answered on 06 Aug 2012, 06:13 PM
 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.

Greetings,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Steve
Top achievements
Rank 1
Answers by
Steve
Top achievements
Rank 1
Iva Toteva
Telerik team
Share this question
or