using Novacode; using System.Drawing; namespace Hotline.Share.Dtos.ExportWord { public class ExportTable : IWordElement { /// /// /// public List Rows { get; set; } = new List(); /// /// /// public int RowCount => Rows.Count; /// /// /// public int ColumnCount { get; } /// /// /// public List<(int, int, int)> MergeCellsInColumns { get; } = new List<(int, int, int)>(); /// /// /// public List<(int, int, int)> MergeCellsInRows { get; } = new List<(int, int, int)>(); public ExportTable() { } public ExportTable(int rowCount, int columnCount) { ColumnCount = columnCount; for (int i = 0; i < rowCount; i++) { ExportTableRow fWTableRow = new ExportTableRow(); for (int j = 0; j < columnCount; j++) { ExportTableCell item = new ExportTableCell { Paragraphs = new List { new ExportParagraph { Run = new ExportRun() } } }; fWTableRow.Cells.Add(item); } Rows.Add(fWTableRow); } } public void MergeCellsInColumn(int columnIndex, int startRow, int endRow) { MergeCellsInColumns.Add((columnIndex, startRow, endRow)); } public void MergeCellsInRow(int rowIndex, int startColumn, int endColumn) { MergeCellsInRows.Add((rowIndex, startColumn, endColumn)); } } public class ExportTableCell { /// /// /// public List Paragraphs { get; set; } /// /// /// public double Width { get; set; } = 200.0; /// /// /// public Color FillColor { get; set; } = Color.Empty; /// /// /// public VerticalAlignment VerticalAlignment { get; set; } = VerticalAlignment.Center; } public class ExportTableRow { /// /// /// public List Cells { get; set; } = new List(); /// /// /// public double Height { get; set; } } public class ExportText : IWordElement { /// /// /// public string Data { get; set; } } }