This question is locked. New answers and comments are not allowed.
Hi,
I have a problem printing tables from a RadDocument. Take the example below, where the table has two rows, a header which has a black background and white text and a data row, which has white background and black text.
The preview is showed ok, but when printing both rows have white background and black text.
Thanks.
I have a problem printing tables from a RadDocument. Take the example below, where the table has two rows, a header which has a black background and white text and a data row, which has white background and black text.
The preview is showed ok, but when printing both rows have white background and black text.
Why this is happening? How could it be avoided?usingSystem;usingSystem.Linq;usingSystem.Windows.Controls;usingSystem.Windows.Media;usingTelerik.Windows.Controls;usingTelerik.Windows.Documents.FormatProviders;usingTelerik.Windows.Documents.FormatProviders.Html;usingTelerik.Windows.Documents.Model;usingTelerik.Windows.Documents.UI;namespaceprintingTest{publicpartialclassMainPage : UserControl{publicMainPage(){InitializeComponent();PrintPreview();}publicvoidPrintPreview(){DocumentFormatProvidersManager.RegisterFormatProvider(newHtmlFormatProvider());var printingRichTextBox =newRadRichTextBox();RadDocument document = CreateDocumentHeader();printingRichTextBox.Document = document;printingRichTextBox.Print(string.Empty, PrintMode.Html);printingRichTextBox.PrintPreview();}privatestaticRadDocument CreateDocumentHeader(){RadDocument document =newRadDocument();Table table =newTable();table.Borders =newTableBorders(newTelerik.Windows.Documents.Model.Border(1, BorderStyle.Single, Colors.Black));TableRow headerRow =newTableRow();TableCell cellHeader =newTableCell();cellHeader.Background = Colors.Black;Paragraph paragraphHeader =newParagraph();Span spanHeader =newSpan();spanHeader.ForeColor = Colors.White;spanHeader.Text ="SAMPLE HEADER TEXT - SAMPLE HEADER TEXT";paragraphHeader.Inlines.Add(spanHeader);cellHeader.Blocks.Add(paragraphHeader);headerRow.Cells.Add(cellHeader);TableRow dataRow =newTableRow();TableCell cellData =newTableCell();cellData.Background = Colors.White;Paragraph paragraphData =newParagraph();Span spanData =newSpan();spanData.ForeColor = Colors.Black;spanData.Text ="Lorem ipsum dolor sit amet, consectetuer adipiscing elit";paragraphData.Inlines.Add(spanData);cellData.Blocks.Add(paragraphData);dataRow.Cells.Add(cellData);table.Rows.Add(headerRow);table.Rows.Add(dataRow);Paragraph tableIsDangerousToGoAlone1 =newParagraph();Paragraph tableIsDangerousToGoAlone2 =newParagraph();Section section =newSection();section.Blocks.Add(tableIsDangerousToGoAlone1);section.Blocks.Add(table);section.Blocks.Add(tableIsDangerousToGoAlone2);document.Sections.Add(section);returndocument;}}}
Thanks.