public static void PrintPlayoffs(Playoffs playoffs, PlayoffRound round)
 {
     if (playoffs == null) return;
     IDocumentPaginatorSource flowDocument = XamlTemplatePrinter.RenderFlowDocumentTemplate(playoffs, round);
     PrintDocument(flowDocument);
 }
        private static IDocumentPaginatorSource RenderFlowDocumentTemplate(Playoffs playoffs, PlayoffRound round)
        {
            string rawXamlText = GetPlayoffsTableXamlString(playoffs, round);

            //Use the XAML reader to create a FlowDocument from the XAML string.
            FlowDocument document = XamlReader.Load(new XmlTextReader(new StringReader(rawXamlText))) as FlowDocument;
            return document;
        }
        private static string GetPlayoffsTableXamlString(Playoffs playoffs, PlayoffRound round)
        {
            StringBuilder xamlString = new StringBuilder();

            xamlString.AppendLine("<FlowDocument xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" ");
            xamlString.AppendLine(" ColumnWidth=\"400\" FontSize=\"16\" FontFamily=\"Arial\">");

            //Header
            xamlString.AppendLine("<Paragraph TextAlignment=\"Center\" FontSize=\"16pt\" FontWeight=\"Bold\">");

            string header = string.Empty;
            switch (round)
            {
                case PlayoffRound.Final_16:
                    header = StringTable.MainWindow_1_16;
                    break;
                case PlayoffRound.Final_8:
                    header = StringTable.MainWindow_1_8;
                    break;
                case PlayoffRound.Final_4:
                    header = StringTable.MainWindow_1_4;
                    break;
                case PlayoffRound.Final_2:
                    header = StringTable.MainWindow_1_2;
                    break;
                case PlayoffRound.Final:
                    header = StringTable.MainWindow_Final;
                    break;
                default:
                    break;
            }

            xamlString.Append(header);
            xamlString.AppendLine("</Paragraph>");

            //Tabela gier
            xamlString.AppendLine("<Table CellSpacing=\"10\">");
            xamlString.AppendLine("<Table.Columns><TableColumn Width=\"100\"/><TableColumn Width=\"200\"/><TableColumn Width=\"200\"/></Table.Columns>");
            xamlString.AppendLine("<TableRowGroup>");

            //Header tabeli
            xamlString.AppendLine("<TableRow>");
            xamlString.AppendFormat("<TableCell><Paragraph FontSize=\"16pt\" FontWeight=\"Bold\" TextAlignment=\"Right\">{0}</Paragraph></TableCell>", StringTable.RoundControl_Nr);
            xamlString.AppendLine();
            xamlString.AppendFormat("<TableCell><Paragraph FontSize=\"16pt\" FontWeight=\"Bold\">{0}</Paragraph></TableCell>", StringTable.RoundControl_Gracz1);
            xamlString.AppendLine();
            xamlString.AppendFormat("<TableCell><Paragraph FontSize=\"16pt\" FontWeight=\"Bold\">{0}</Paragraph></TableCell>", StringTable.RoundControl_Gracz2);
            xamlString.AppendLine();
            xamlString.AppendLine("</TableRow>");

            //wiersze tabeli
            int lp = 1;

            switch (round)
            {
                #region 1/16

                case PlayoffRound.Final_16:

                    if (!playoffs.IsFinal16()) break;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_01.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_01.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_02.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_02.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_03.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_03.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_04.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_04.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_05.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_05.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_06.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_06.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_07.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_07.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_08.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_08.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_09.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_09.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_10.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_10.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_11.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_11.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_12.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_12.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_13.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_13.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_14.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_14.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_15.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_15.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_16.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_16_16.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    break;

                #endregion

                #region 1/8

                case PlayoffRound.Final_8:

                    if (!playoffs.IsFinal8()) break;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_01.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_01.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_02.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_02.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_03.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_03.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_04.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_04.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_05.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_05.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_06.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_06.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_07.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_07.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_08.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_8_08.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    break;

                #endregion

                #region 1/4

                case PlayoffRound.Final_4:

                    if (!playoffs.IsFinal4()) break;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_01.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_01.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_02.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_02.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_03.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_03.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_04.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_4_04.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    break;

                #endregion

                #region 1/2

                case PlayoffRound.Final_2:

                    if (!playoffs.IsFinal2()) break;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_2_01.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_2_01.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    xamlString.AppendFormat("<TableRow {0}>", lp % 2 == 0 ? " Background=\"LightGray\"" : string.Empty);
                    xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_2_02.Player1Alias));
                    xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final_2_02.Player2Alias));
                    xamlString.AppendLine("</TableRow>");
                    lp++;

                    break;

                #endregion

                #region Final

                case PlayoffRound.Final:

                    if (playoffs.IsFinal())
                    {
                        xamlString.Append("<TableRow>");
                        xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                        xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final.Player1Alias));
                        xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Final.Player2Alias));
                        xamlString.AppendLine("</TableRow>");
                        lp++;
                    }

                    if (playoffs.IsGame3rd())
                    {
                        xamlString.AppendLine("</TableRowGroup>");
                        xamlString.AppendLine("</Table>");

                        xamlString.AppendLine("<Paragraph TextAlignment=\"Center\" FontSize=\"16pt\" FontWeight=\"Bold\"></Paragraph>");
                        xamlString.AppendFormat("<Paragraph TextAlignment=\"Center\" FontSize=\"16pt\" FontWeight=\"Bold\">{0}</Paragraph>", StringTable.MainWindow_GraOTrzecieMiejsce);
                        xamlString.AppendLine();

                        //Tabela finału
                        xamlString.AppendLine("<Table CellSpacing=\"10\">");
                        xamlString.AppendLine("<Table.Columns><TableColumn Width=\"100\"/><TableColumn Width=\"200\"/><TableColumn Width=\"200\"/></Table.Columns>");
                        xamlString.AppendLine("<TableRowGroup>");

                        //Header tabeli
                        xamlString.AppendLine("<TableRow>");
                        xamlString.AppendFormat("<TableCell><Paragraph FontSize=\"16pt\" FontWeight=\"Bold\" TextAlignment=\"Right\">{0}</Paragraph></TableCell>", StringTable.RoundControl_Nr);
                        xamlString.AppendLine();
                        xamlString.AppendFormat("<TableCell><Paragraph FontSize=\"16pt\" FontWeight=\"Bold\">{0}</Paragraph></TableCell>", StringTable.RoundControl_Gracz1);
                        xamlString.AppendLine();
                        xamlString.AppendFormat("<TableCell><Paragraph FontSize=\"16pt\" FontWeight=\"Bold\">{0}</Paragraph></TableCell>", StringTable.RoundControl_Gracz2);
                        xamlString.AppendLine();
                        xamlString.AppendLine("</TableRow>");

                        xamlString.Append("<TableRow>");
                        xamlString.AppendFormat("<TableCell><Paragraph TextAlignment=\"Right\">{0}</Paragraph></TableCell>", lp);
                        xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Game3rdPlace.Player1Alias));
                        xamlString.AppendFormat("<TableCell><Paragraph>{0}</Paragraph></TableCell>", SecurityElement.Escape(playoffs.Game3rdPlace.Player2Alias));
                        xamlString.AppendLine("</TableRow>");
                        lp++;
                    }

                    break;

                #endregion

                default:
                    break;
            }

            xamlString.AppendLine("</TableRowGroup>");
            xamlString.AppendLine("</Table>");

            //koniec dokumentu
            xamlString.AppendLine("</FlowDocument>");

            return xamlString.ToString();
        }