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....
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.
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.