using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
namespace TestProject;
/// <summary>
/// 메인 윈도우
/// </summary>
public partial class MainWindow : Window
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainWindow()
/// <summary>
/// 생성자
/// </summary>
public MainWindow()
{
InitializeComponent();
TableColumn tableColumn1 = new TableColumn { Width = GridLength.Auto };
TableColumn tableColumn2 = new TableColumn { Width = GridLength.Auto };
TableColumn tableColumn3 = new TableColumn { Width = GridLength.Auto };
Paragraph headerCellParagraph1 = new Paragraph(new Run("Header 1"));
Paragraph headerCellParagraph2 = new Paragraph(new Run("Header 2"));
Paragraph headerCellParagraph3 = new Paragraph(new Run("Header 3"));
TableCell headerTableCell1 = new TableCell { BorderThickness = new Thickness(1), BorderBrush = Brushes.Black, Padding = new Thickness(3), Background = Brushes.LightGray, TextAlignment = TextAlignment.Center };
TableCell headerTableCell2 = new TableCell { BorderThickness = new Thickness(1), BorderBrush = Brushes.Black, Padding = new Thickness(3), Background = Brushes.LightGray, TextAlignment = TextAlignment.Center };
TableCell headerTableCell3 = new TableCell { BorderThickness = new Thickness(1), BorderBrush = Brushes.Black, Padding = new Thickness(3), Background = Brushes.LightGray, TextAlignment = TextAlignment.Center };
headerTableCell1.Blocks.Add(headerCellParagraph1);
headerTableCell2.Blocks.Add(headerCellParagraph2);
headerTableCell3.Blocks.Add(headerCellParagraph3);
TableRow headerTableRow = new TableRow();
headerTableRow.Cells.Add(headerTableCell1);
headerTableRow.Cells.Add(headerTableCell2);
headerTableRow.Cells.Add(headerTableCell3);
Paragraph dataCellParagraph1 = new Paragraph(new Run("Row 1, Cell 1"));
Paragraph dataCellParagraph2 = new Paragraph(new Run("Row 1, Cell 2"));
Paragraph dataCellParagraph3 = new Paragraph(new Run("Row 1, Cell 3"));
TableCell dataTableCell1 = new TableCell { BorderThickness = new Thickness(1), BorderBrush = Brushes.Black, Padding = new Thickness(3) };
TableCell dataTableCell2 = new TableCell { BorderThickness = new Thickness(1), BorderBrush = Brushes.Black, Padding = new Thickness(3) };
TableCell dataTableCell3 = new TableCell { BorderThickness = new Thickness(1), BorderBrush = Brushes.Black, Padding = new Thickness(3) };
dataTableCell1.Blocks.Add(dataCellParagraph1);
dataTableCell2.Blocks.Add(dataCellParagraph2);
dataTableCell3.Blocks.Add(dataCellParagraph3);
TableRow dataTableRow1 = new TableRow();
dataTableRow1.Cells.Add(dataTableCell1);
dataTableRow1.Cells.Add(dataTableCell2);
dataTableRow1.Cells.Add(dataTableCell3);
Paragraph dataCellParagraph4 = new Paragraph(new Run("Row 2, Cell 1"));
Paragraph dataCellParagraph5 = new Paragraph(new Run("Row 2, Cell 2"));
Paragraph dataCellParagraph6 = new Paragraph(new Run("Row 2, Cell 3"));
TableCell dataTableCell4 = new TableCell { BorderThickness = new Thickness(1), BorderBrush = Brushes.Black, Padding = new Thickness(3) };
TableCell dataTableCell5 = new TableCell { BorderThickness = new Thickness(1), BorderBrush = Brushes.Black, Padding = new Thickness(3) };
TableCell dataTableCell6 = new TableCell { BorderThickness = new Thickness(1), BorderBrush = Brushes.Black, Padding = new Thickness(3) };
dataTableCell4.Blocks.Add(dataCellParagraph4);
dataTableCell5.Blocks.Add(dataCellParagraph5);
dataTableCell6.Blocks.Add(dataCellParagraph6);
TableRow dataTableRow2 = new TableRow();
dataTableRow2.Cells.Add(dataTableCell4);
dataTableRow2.Cells.Add(dataTableCell5);
dataTableRow2.Cells.Add(dataTableCell6);
TableRowGroup tableRowGroup = new TableRowGroup();
tableRowGroup.Rows.Add(headerTableRow);
tableRowGroup.Rows.Add(dataTableRow1 );
tableRowGroup.Rows.Add(dataTableRow2 );
Table table = new Table();
table.BorderThickness = new Thickness(1);
table.BorderBrush = Brushes.Black;
table.CellSpacing = 3;
table.Columns.Add(tableColumn1);
table.Columns.Add(tableColumn2);
table.Columns.Add(tableColumn3);
table.RowGroups.Add(tableRowGroup);
this.flowDocument.Blocks.Add(table);
}
#endregion
}