private void MergeAndSetGroupingRowStyle( int row, int lastColumnInSheet, TgExcelStyle style, int groupItemsCount) { var fromCol = GridOptions.TableLeftPosition; var toCol = lastColumnInSheet; var groupingRow = Worksheet.Cells[row, fromCol, row, toCol]; groupingRow.Merge = true; groupingRow.Style.SetStyle(style); if (GridOptions.GroupOptions.IsGroupCollapsable) { var toRow = row + groupItemsCount + (GridOptions.HasColumnSummary ? 1 : 0); for (var i = row + 1; i <= toRow; i++) { Worksheet.Row(i).OutlineLevel = 1; } } }
public static void SetStyle(this ExcelStyle excelStyle, TgExcelStyle tgExcelStyle) { if (tgExcelStyle == null) { return; } tgExcelStyle.Fill?.ToExcelFill(excelStyle.Fill); tgExcelStyle.Border?.ToExcelBorder(excelStyle.Border); tgExcelStyle.Font?.ToExcelFont(excelStyle.Font); excelStyle.WrapText = tgExcelStyle.WrapText; excelStyle.Hidden = tgExcelStyle.Hidden; excelStyle.HorizontalAlignment = tgExcelStyle.HorizontalAlignment; excelStyle.VerticalAlignment = tgExcelStyle.VerticalAlignment; excelStyle.Indent = tgExcelStyle.Indent; excelStyle.Locked = tgExcelStyle.Locked; excelStyle.Numberformat.Format = tgExcelStyle.DisplayFormat; excelStyle.QuotePrefix = tgExcelStyle.QuotePrefix; excelStyle.ReadingOrder = tgExcelStyle.ReadingOrder; excelStyle.ShrinkToFit = tgExcelStyle.ShrinkToFit; excelStyle.TextRotation = tgExcelStyle.TextRotation; }