static void EasyWriterTest(string FileName) { var styles = new OpenXmlExStyles( new List <BaseOpenXmlExStyle>() { new BaseOpenXmlExStyle() { FontColor = System.Drawing.Color.Crimson, IsBoldFont = true }, new BaseOpenXmlExStyle() { FontSize = 20, FontName = "Calibri", BorderColor = System.Drawing.Color.Red } }); using var writer = new EasyWriter(FileName, styles); #region 1 лист var sheet_name_1 = "Test_sheet_name"; writer.AddNewSheet(sheet_name_1); #region Надстройка страницы - кнопки группировки сверху writer.SetGrouping(false, false); #endregion #region Установка ширины колонок //Установка размеров колонок var width_setting = new List <WidthOpenXmlEx> { new (1, 2, 7), new (3, 3, 11), new (4, 12, 9.5), new (13, 13, 17), new (14, 14, 40), new (15, 16, 15), new (18, 20, 15) }; writer.SetWidth(width_setting); #endregion var(key, value) = writer.FindStyleOrDefault( new BaseOpenXmlExStyle() { FontColor = System.Drawing.Color.Crimson, FontSize = 20, IsBoldFont = true, LeftBorderStyle = BorderStyleValues.Dashed, RightBorderStyle = BorderStyleValues.Dashed }); #region SheetData writer.AddRow(3, 0, true, true); writer.AddCell("Test", 1, 3, 0); writer.AddCell("Test", 7, 3, 0); writer.AddRow(4, 0, true, true); writer.AddCell("Test", 4, 4, 1); writer.AddCell("Test", 5, 4, 2); writer.AddCell("Test", 6, 4, 3); writer.AddCell("Test", 7, 4, 3); #endregion #region Secondary setting writer.MergeCells(6, 3, 10, 5); writer.SetFilter(1, 5, 3, 5); #endregion #endregion #region 2 лист var sheet_name_2 = "Sheet 2.0"; writer.AddNewSheet(sheet_name_2); #region Надстройка страницы - кнопки группировки сверху writer.SetGrouping(false, false); #endregion #region Установка ширины колонок writer.SetWidth(width_setting); #endregion #region SheetData writer.AddRow(3, 0, true, true); writer.AddCell("Test 2", 1, 3, 0); writer.AddCell("Test 2", 7, 3, 0); writer.AddRow(4, 0, true, true); writer.AddCell("Test 2", 4, 4, 1); writer.AddCell("Test 2", 5, 4, 2); writer.AddCell("Test 2", 6, 4, 3); writer.AddCell("Test 2", 7, 4, 3); writer.MergeCells(6, 3, 10, 5); #endregion #region Secondary setting writer.SetFilter(1, 5, 3, 5); #endregion #endregion }