123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using Novacode;
- using System.Drawing;
- namespace Hotline.Share.Dtos.ExportWord
- {
- public class ExportTable : IWordElement
- {
- /// <summary>
- ///
- /// </summary>
- public List<ExportTableRow> Rows { get; set; } = new List<ExportTableRow>();
- /// <summary>
- ///
- /// </summary>
- public int RowCount => Rows.Count;
- /// <summary>
- ///
- /// </summary>
- public int ColumnCount { get; }
- /// <summary>
- ///
- /// </summary>
- public List<(int, int, int)> MergeCellsInColumns { get; } = new List<(int, int, int)>();
- /// <summary>
- ///
- /// </summary>
- 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<ExportParagraph>
- {
- 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
- {
- /// <summary>
- ///
- /// </summary>
- public List<ExportParagraph> Paragraphs { get; set; }
- /// <summary>
- ///
- /// </summary>
- public double Width { get; set; } = 200.0;
- /// <summary>
- ///
- /// </summary>
- public Color FillColor { get; set; } = Color.Empty;
- /// <summary>
- ///
- /// </summary>
- public VerticalAlignment VerticalAlignment { get; set; } = VerticalAlignment.Center;
- }
- public class ExportTableRow
- {
- /// <summary>
- ///
- /// </summary>
- public List<ExportTableCell> Cells { get; set; } = new List<ExportTableCell>();
- /// <summary>
- ///
- /// </summary>
- public double Height { get; set; }
- }
- public class ExportText : IWordElement
- {
- /// <summary>
- ///
- /// </summary>
- public string Data { get; set; }
- }
- }
|