Click here to Skip to main content
15,794,475 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am creating wpf application where in Rich textbox user can paste tables,which background should be black by default and font and border of rows, Columns in white color.

What I have tried:

IEnumerable table1 = richTextBox1.Document.Blocks.OfType<Table>();

foreach (Table tb1 in table1)
    for (int i = 0; i < tb1.RowGroups[0].Rows.Count; ++i)
        TableRow currentRow = tb1.RowGroups[0].Rows[i];
        var brushConverter = new BrushConverter();
        currentRow.Background = (Brush)brushConverter.ConvertFrom("#FFe2e2e2"); // grey background
        currentRow.Foreground = (Brush)brushConverter.ConvertFrom("#FF000000"); // black text                 
        // currentRow.FontWeight = FontWeights.UltraBold;
        currentRow.FontFamily = new FontFamily("Arial Black");
        currentRow.FontSize = 16.0;
        currentRow.FontStretch = FontStretches.UltraExpanded;
        currentRow.FontStyle = FontStyles.Italic;
        currentRow.FontWeight = FontWeights.UltraBold;
        //currentRow.FontWeight = FontWeights.Bold;
Updated 1-Aug-21 23:45pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900