Completed
Last Updated: 03 Sep 2018 07:46 by Dimitar
To reproduce:

public RadForm1()
{
    InitializeComponent();

    this.radGridView1.EnableFiltering = true;
    this.radGridView1.ShowHeaderCellButtons = true;

    this.radGridView1.FilterPopupRequired += radGridView1_FilterPopupRequired; 
}

private void radGridView1_FilterPopupRequired(object sender, Telerik.WinControls.UI.FilterPopupRequiredEventArgs e)
{
    e.FilterPopup.PopupOpening -= FilterPopup_PopupOpening; 
    e.FilterPopup.PopupOpening += FilterPopup_PopupOpening; 
}

private void FilterPopup_PopupOpening(object sender, CancelEventArgs args)
{
    args.Cancel = true;
}

Workaround: either set the ShowHeaderCellButtons property to false or closed the popup immediately after it is opened.

private void radGridView1_FilterPopupRequired(object sender, Telerik.WinControls.UI.FilterPopupRequiredEventArgs e)
{
    e.FilterPopup.PopupOpening -= FilterPopup_PopupOpening; 
    e.FilterPopup.PopupOpening += FilterPopup_PopupOpening; 
}

private void FilterPopup_PopupOpening(object sender, CancelEventArgs args)
{ 
    RadListFilterPopup popup = sender as RadListFilterPopup;
    popup.PopupOpened -= popup_PopupOpened;
    popup.PopupOpened += popup_PopupOpened;
}

private void popup_PopupOpened(object sender, EventArgs args)
{
    RadListFilterPopup popup = sender as RadListFilterPopup;
    popup.ClosePopup(RadPopupCloseReason.Mouse);
}

Completed
Last Updated: 10 Oct 2017 12:22 by ADMIN
How to reproduce: check the attached project

Workaround: create a custom RadListFilterPopup
public class MyRadListFilterPopup : RadListFilterPopup
    {
        public MyRadListFilterPopup(GridViewDataColumn dataColumn, bool groupedDateValues)
            : base(dataColumn, groupedDateValues)
        { }

        protected override void OnButtonOkClick(EventArgs e)
        {
            FilterOperator filterOperator = FilterOperator.IsEqualTo;

            IRadListFilterElement listFilterElement = (IRadListFilterElement)typeof(RadListFilterPopup).GetField("listFilterElement", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this);
            RadListFilterDistinctValuesTable selectedValues = listFilterElement.SelectedValues;

            switch (listFilterElement.SelectedMode)
            {
                case ListFilterSelectedMode.All:
                    filterOperator = FilterOperator.None;
                    break;
                case ListFilterSelectedMode.Null:
                    filterOperator = FilterOperator.IsNull;
                    break;
                case ListFilterSelectedMode.NotNull:
                    filterOperator = FilterOperator.IsNotNull;
                    break;
            }

            if (filterOperator != FilterOperator.IsEqualTo)
            {
                SetFilterOperator(filterOperator);
                this.ClosePopup(RadPopupCloseReason.CloseCalled);
            }
            else
            {
                CompositeFilterDescriptor compositeFilterDescriptor = new CompositeFilterDescriptor();
                compositeFilterDescriptor.PropertyName = this.DataColumn.Name;
                RadListFilterDistinctValuesTable distinctValues = this.GetDistinctValuesTable();
                string blanksKey = RadGridLocalizationProvider.CurrentProvider.GetLocalizedString(RadGridStringId.FilterMenuBlanks);
                bool blanks = selectedValues.Contains(blanksKey);
                if (selectedValues.Count > distinctValues.Count / 2 && !blanks)
                {
                    compositeFilterDescriptor.LogicalOperator = FilterLogicalOperator.And;

                    foreach (DictionaryEntry entry in distinctValues)
                    {
                        string key = (string)entry.Key;
                        if (string.IsNullOrEmpty(key))
                        {
                            key = blanksKey;
                        }

                        if (!selectedValues.Contains(key))
                        {
                            foreach (object value in (ArrayList)entry.Value)
                            {
                                FilterDescriptor descriptor;
                                if (value == DBNull.Value)
                                {
                                    descriptor = new FilterDescriptor(this.DataColumn.Name, FilterOperator.IsNotEqualTo, null);
                                }
                                else if (this.DataColumn is GridViewDateTimeColumn || this.DataColumn.DataType == typeof(DateTime) || this.DataColumn.DataType == typeof(DateTime?))
                                {
                                    descriptor = new DateFilterDescriptor(this.DataColumn.Name, FilterOperator.IsNotEqualTo, (DateTime?)value, false);
                                }
                                else
                                {
                                    descriptor = new FilterDescriptor(this.DataColumn.Name, FilterOperator.IsNotEqualTo, value);
                                }

                                compositeFilterDescriptor.FilterDescriptors.Add(descriptor);
                            }
                        }
                    }
                }
                else
                {
                    compositeFilterDescriptor.LogicalOperator = FilterLogicalOperator.Or;

                    foreach (DictionaryEntry entry in selectedValues)
                    {
                        foreach (object value in (ArrayList)entry.Value)
                        {
                            FilterDescriptor descriptor;
                            if (value == DBNull.Value)
                            {
                                descriptor = new FilterDescriptor(this.DataColumn.Name, FilterOperator.IsNotEqualTo, null);
                            }
                            else if (this.DataColumn is GridViewDateTimeColumn || this.DataColumn.DataType == typeof(DateTime) || this.DataColumn.DataType == typeof(DateTime?))
                            {
                                descriptor = new DateFilterDescriptor(this.DataColumn.Name, FilterOperator.IsEqualTo, (DateTime?)value, false);
                            }
                            else
                            {
                                descriptor = new FilterDescriptor(this.DataColumn.Name, FilterOperator.IsEqualTo, value);
                            }

                            compositeFilterDescriptor.FilterDescriptors.Add(descriptor);
                        }
                    }
                }

                this.FilterDescriptor = compositeFilterDescriptor;
                OnFilterConfirmed();
            }
        }
    }
Unplanned
Last Updated: 20 Nov 2017 15:37 by ADMIN
To reproduce: we have a RadPageView with two grids on two pages. The first grid has a ColumnGroupsViewDefinition applied. When you open the Property Builder and try to hide some of the columns, the error occurs.

Workaround: make the changes programamtically at run time.
Unplanned
Last Updated: 21 Nov 2017 09:40 by ADMIN
By default, when I am expanding a group and start sorting, the expanded group doesn't collapse. However, if you use a group comparer, all groups will always collapse, when you click a header cell to sort.
Unplanned
Last Updated: 08 Oct 2019 12:15 by ADMIN
Completed
Last Updated: 13 Dec 2017 13:42 by ADMIN
To reproduce:

1. Add a GridViewCheckBoxColumn with EnableHeaderCheckBox property set to true.
2. Use the TypeConverter demonstrated in the following help article: http://docs.telerik.com/devtools/winforms/gridview/columns/converting-data-types

When you run the application and try to toggle the check box in the header cell, a FormatException occurs. 

Workaround: modify the TypeConverter:

public class ToggleStateConverter : TypeConverter
{
    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
    {
        return destinationType == typeof(ToggleState);
    }

    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
    {
        char charValue = (char)value;

        switch (charValue)
        {
            case 'Y':
                return ToggleState.On;
            case 'N':
                return ToggleState.Off;
            case 'M':
                return ToggleState.Indeterminate;
        }

        return base.ConvertTo(context, culture, value, destinationType);
    }

    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
    {
        return sourceType == typeof(ToggleState) || sourceType == typeof(bool);
    }

    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
    {
        ToggleState state;
        bool boolValue;

        if (value is ToggleState)
        {
            state = (ToggleState)value ; 
            switch (state)
            {
                case ToggleState.On:
                    return 'Y';
                case ToggleState.Off:
                    return 'N';
                case ToggleState.Indeterminate:
                    return 'M';
            }
        }
        else if (value is bool)
        {
            boolValue = (bool)value;
             switch (boolValue)
            {
                case true:
                    return 'Y';
                case false:
                    return 'N';
                default:
                    return 'M';
            }
        }
       
        return base.ConvertFrom(context, culture, value);
    }
}
Completed
Last Updated: 05 Sep 2017 09:42 by ADMIN
Currently, DisplayFormatType.GeneralDate, DisplayFormatType.ShortDate, DisplayFormatType.MediumDate all return culture's DateTimeFormat.ShortDatePattern. 

Workaround: 
GridViewDateTimeColumn columnDateTime = this.radGridView1.Columns["Date"] as GridViewDateTimeColumn;
columnDateTime.ExcelExportType = DisplayFormatType.Custom; 
columnDateTime.ExcelExportFormatString  = "dd/MM/yyyy hh:mm:ss";
Completed
Last Updated: 11 Sep 2017 10:27 by ADMIN
To reproduce: bind the grid to a DataTable where one of the columns doesn't allow null values. Try to add a new record by using the new row in the grid. Even though you specify default values in the DefaultValuesNeeded event, the error still occurs. Please refer to the attached sample project and gif file.

Workaround: handle the RadGridView.DataError event:

private void RadGridView1_DataError(object sender, Telerik.WinControls.UI.GridViewDataErrorEventArgs e)
{
    if (e.Exception.ToString().Contains("does not allow nulls"))
    {
        e.Cancel = true;
    }
}
Unplanned
Last Updated: 25 Apr 2024 13:11 by Ashley
It appears that this scenario is not handled properly in our exporter. Consider the case where you have two templates that use view definition. 

The view definition from the second template is not exported at all.
Completed
Last Updated: 22 Dec 2017 11:43 by ADMIN
How to reproduce:
public partial class Form1 : Form
{
    private DataTable dt = new DataTable();

    public Form1()
    {
        InitializeComponent();

        this.FillData();

        this.radGridView1.DataSource = this.dt;
        this.radGridView1.EnableSorting = true;
        this.radGridView1.EnableFiltering = true;

        this.radGridView1.MasterTemplate.DataView.BypassSort = true;
        this.radGridView1.SortChanged += radGridView1_SortChanged;
        this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
    }

    public void FillData()
    {
        dt.Columns.Add("Id", typeof(int));
        dt.Columns.Add("Name", typeof(string));

        for (int i = 0; i < 30; i++)
        {
            dt.Rows.Add(i, "Item" + i);
        }
    }

    private void radGridView1_SortChanged(object sender, Telerik.WinControls.UI.GridViewCollectionChangedEventArgs e)
    {
        if (e.Action == NotifyCollectionChangedAction.Add || e.Action == NotifyCollectionChangedAction.ItemChanged)
        {
            SortDescriptor s = e.NewItems[0] as SortDescriptor;
            string sortOperator = "";
            if (s.Direction == ListSortDirection.Ascending)
            {
                sortOperator = "ASC";
            }
            else
            {
                sortOperator = "DESC";
            }
            dt.DefaultView.Sort = s.PropertyName + " " + sortOperator;
        }
        if (e.Action == NotifyCollectionChangedAction.Remove)
        {
            dt.DefaultView.Sort = "";
        }
    }
}

Workaround: 
public partial class Form1 : Form
{
    private DataTable dt = new DataTable();

    public Form1()
    {
        InitializeComponent();

        this.FillData();

        this.radGridView1.DataSource = this.dt;
        this.radGridView1.EnableSorting = true;
        this.radGridView1.EnableFiltering = true;

        this.radGridView1.MasterTemplate.DataView.BypassSort = true;
        this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;

        this.radGridView1.CellBeginEdit += RadGridView1_CellBeginEdit;
        this.radGridView1.CellEndEdit += RadGridView1_CellEndEdit;
    }

    private void RadGridView1_CellEndEdit(object sender, GridViewCellEventArgs e)
    {
        if (e.Row is GridViewFilteringRowInfo)
        {
            this.radGridView1.MasterTemplate.DataView.BypassSort = true;
        }
    }

    private void RadGridView1_CellBeginEdit(object sender, Telerik.WinControls.UI.GridViewCellCancelEventArgs e)
    {
        if (e.Row is GridViewFilteringRowInfo)
        {
            this.radGridView1.MasterTemplate.DataView.BypassSort = false;
        }
    }
    public void FillData()
    {
        dt.Columns.Add("Id", typeof(int));
        dt.Columns.Add("Name", typeof(string));

        for (int i = 0; i < 30; i++)
        {
            dt.Rows.Add(i, "Item" + i);
        }
    }
}
Unplanned
Last Updated: 14 Aug 2017 11:51 by ADMIN
ADMIN
Created by: Dess | Tech Support Engineer, Principal
Comments: 0
Category: GridView
Type: Bug Report
1
To reproduce: 
1. Run the attached sample project.
2. Move the form to the right bottom of the screen.
3. Hover a cell to show the tool tip. It will start blinking. Please refer to the attached gif file.

Workaround: use screen tips: http://docs.telerik.com/devtools/winforms/telerik-presentation-framework/tooltips-and-screentips/screen-tips

Unplanned
Last Updated: 14 Aug 2017 11:49 by ADMIN
To reproduce: 
1. Add a RadGridView with a GridViewCheckBoxColumn and enable the paging functionality for it.
2. Toggle the header checkbox on the first page. Only the rows from the page are toggled.

Workaround: you can subscribe to the HeaderCellToggleStateChanged event and toggle all rows:

 private void radGridView1_MouseUp(object sender, MouseEventArgs e)
 {
     if (this.radGridView1.Tag+""=="toggle")
     {
         this.radGridView1.Tag = null;
         this.radGridView1.HeaderCellToggleStateChanged -= radGridView1_HeaderCellToggleStateChanged;
     }
 }

 private void radGridView1_MouseDown(object sender, MouseEventArgs e)
 {
     RadCheckBoxElement element = this.radGridView1.ElementTree.GetElementAtPoint(e.Location) as RadCheckBoxElement;
     if (element != null && element.Parent is GridCheckBoxHeaderCellElement)
     {
         this.radGridView1.Tag = "toggle";
         this.radGridView1.HeaderCellToggleStateChanged += radGridView1_HeaderCellToggleStateChanged;
     }
 }

 private void radGridView1_HeaderCellToggleStateChanged(object sender, GridViewHeaderCellEventArgs e)
 { 
     this.radGridView1.BeginUpdate();
     foreach (GridViewRowInfo row in this.radGridView1.Rows)
     {
         row.Cells["Discontinued"].Value = e.State;
     }
     this.radGridView1.EndUpdate(); 
 }
Completed
Last Updated: 07 Nov 2019 07:03 by ADMIN
ADMIN
Created by: Hristo
Comments: 2
Category: GridView
Type: Bug Report
2
How to reproduce
public partial class Form1 : RadForm
{
    public Form1()
    {
        InitializeComponent();

        GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn();
        textBoxColumn.Name = "Column";
        textBoxColumn.HeaderText = "Column";
        this.radGridView1.MasterTemplate.Columns.Add(textBoxColumn);

        GridViewTextBoxColumn textBoxColumn2 = new GridViewTextBoxColumn();
        textBoxColumn2.Name = "TextBoxColumn2";
        textBoxColumn2.HeaderText = "ReadOnlyColumn";
        this.radGridView1.MasterTemplate.Columns.Add(textBoxColumn2);

        for (int i = 0; i < 10; i++)
        {
            object v = i * 2;
            if (i % 3 == 0)
            {
                v = null;
            }

            this.radGridView1.Rows.Add(new object[] { i, v });
        }

        this.radGridView1.MultiSelect = true;
        foreach (var row in this.radGridView1.Rows)
        {
            foreach (var cell in row.Cells)
            {
                GridViewCellInfo cellInfo = cell as GridViewCellInfo;
                if (cellInfo != null && cellInfo.RowInfo.Index % 3 == 0 && cellInfo.ColumnInfo.Index == 1)
                {
                    cellInfo.ReadOnly = true;
                }
            }
        }
    }

}

Workaround:
public class MyRadGridView : RadGridView
{
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadGridView).FullName;
        }
    }

    protected override RadGridViewElement CreateGridViewElement()
    {
        return new MyRadGridViewElement();
    }
}

internal class MyRadGridViewElement : RadGridViewElement
{
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(RadGridViewElement);
        }
    }

    protected override MasterGridViewTemplate CreateTemplate()
    {
        return new MyMasterGridViewTemplate();
    }
}

internal class MyMasterGridViewTemplate : MasterGridViewTemplate
{
    protected override void PasteDataToRow(List<string> rowData, GridViewRowInfo row)
    {
        {
            int colIndex = this.Owner.CurrentColumn.Index;
            int j = 0;

            while (j < rowData.Count && colIndex < this.CurrentView.ViewTemplate.ColumnCount)
            {
                GridViewColumn col = this.CurrentView.ViewTemplate.Columns[colIndex];
                if (col.IsVisible && !col.ReadOnly && !row.Cells[colIndex].ReadOnly)
                {

                    object value = rowData[j];

                    if (string.IsNullOrEmpty(rowData[j]))
                    {
                        value = null;
                    }
                    else if (this.CurrentView.ViewTemplate.Columns[colIndex].DataType == typeof(string))
                    {
                        GridViewTextBoxColumn textColumn = col as GridViewTextBoxColumn;

                        if (textColumn != null && textColumn.MaxLength > 0)
                        {
                            if (rowData[j].Length > textColumn.MaxLength)
                            {
                                value = rowData[j].Substring(0, textColumn.MaxLength);
                            }
                        }
                    }
                    else if (this.CurrentView.ViewTemplate.Columns[colIndex].DataType == typeof(DateTime))
                    {
                        try
                        {
                            value = DateTime.Parse(rowData[j], this.CurrentView.ViewTemplate.Columns[colIndex].FormatInfo);
                        }
                        catch { }
                    }
                    else if (this.CurrentView.ViewTemplate.Columns[colIndex].DataType == typeof(Color))
                    {
                        try
                        {
                            value = ColorTranslator.FromHtml(rowData[j]);
                        }
                        catch { }
                    }

                    if (this.ClipboardPasteMode == GridViewClipboardPasteMode.EnableWithNotifications)
                    {
                        CellValidatingEventArgs cellValidating = new CellValidatingEventArgs(row, col, value, row.Cells[colIndex].Value, null);
                        this.EventDispatcher.RaiseEvent<CellValidatingEventArgs>(EventDispatcher.CellValidating, this, cellValidating);

                        if (!cellValidating.Cancel)
                        {
                            row.Cells[colIndex].Value = value;

                            CellValidatedEventArgs cellValidated = new CellValidatedEventArgs(row, col, value);
                            this.EventDispatcher.RaiseEvent<CellValidatedEventArgs>(EventDispatcher.CellValidated, this, cellValidated);
                        }
                    }
                    else
                    {
                        row.Cells[colIndex].Value = value;
                    }

                    j++;
                }

                colIndex++;
            }
        }
    }
}


Completed
Last Updated: 15 Aug 2017 11:03 by ADMIN
To reproduce: run the attached sample project:

1. Clear the value in one of the cells.
2. Select the empty cell and press Ctrl+C to copy the empty cell. You will encounter the error coming from the GetFormattedCellValue method.

Workaround: handle the RadGridView.Copying event

private void RadGridView1_Copying(object sender, GridViewClipboardEventArgs e)
{
    if (this.radGridView1.SelectionMode == GridViewSelectionMode.FullRowSelect)
    {
        foreach (var row in this.radGridView1.SelectedRows)
        {
            foreach (var cell in row.Cells)
            {
                GridViewCellInfo cellInfo = cell as GridViewCellInfo;
                if (cellInfo != null && cellInfo.Value == null)
                {
                    cellInfo.Value = "";
                }
            }
        }
    }
    else
    {
        foreach (var cell in this.radGridView1.SelectedCells)
        {
            if (cell.Value == null)
            {
                cell.Value = "";
            }
        }
    }
}
Completed
Last Updated: 17 Jul 2017 13:51 by ADMIN
To reproduce:
- Create ColumnGroupsViewDefinition and export it with the following code:

SpreadExportRenderer renderer = new SpreadExportRenderer();
GridViewSpreadExport spreadExporter = new GridViewSpreadExport(radGridView1);
spreadExporter.FreezeHeaderRow = true;
spreadExporter.ExportViewDefinition = true;
spreadExporter.ExportVisualSettings = true;
spreadExporter.ExportGroupedColumns = true;
spreadExporter.ExportHierarchy = true;
spreadExporter.SheetMaxRows = ExcelMaxRows._1048576;
spreadExporter.ExportFormat = SpreadExportFormat.Xlsx;
spreadExporter.FileExportMode = FileExportMode.CreateOrOverrideFile;
spreadExporter.RunExport(dialog.FileName, renderer);

Workaround:
- Set FreezeHeaderRow to false.
 
You can manually freeze the rows as well:

private void Renderer_WorkbookCreated(object sender, WorkbookCreatedEventArgs e)
{
   e.Workbook.ActiveWorksheet.ViewState.FreezePanes(2, 0);
}
Unplanned
Last Updated: 14 Aug 2017 11:46 by ADMIN
To reproduce:  run the attached sample project and group by the Id column.

Workaround: use the ViewCellFormatting event to populate the missing values or use a custom  GridViewSummaryItem and override the Evaluate method in order to achieve the desired calculation.
Declined
Last Updated: 18 Aug 2017 05:24 by mostafa
Created by: mostafa
Comments: 2
Category: GridView
Type: Feature Request
1
Hi Mostafa,

The end users can copy a single cell even when the SelectionMode is set to FullRowSelect via the ContextMenu when opening it on any of the data cells. If the context menu is opened on the row header they will select the whole row. Please check the attached video: radgridview-context-menu-behavior.gif.

If you would like to copy a single cell using the Ctrl-C command and have the grid setup in FullRowSelect mode please check the attached project featuring a solution. I am also attaching a video showing the result using the custom implementation in the project: radgridview-full-row-ctrl-c.gif
Unplanned
Last Updated: 19 Jun 2017 11:20 by ADMIN
To reproduce: please refer to the attached gif file.
1. Run the attached sample project.
2. Toggle the checkbox and scroll to a specific row.
3. Click the button to hide a column. You will notice that the vertical scrollbar changes its position. If the AutoSizeRows property is set to false, the scrollbar keeps its position.

Workaround:
private void radToggleButton1_ToggleStateChanged(object sender, Telerik.WinControls.UI.StateChangedEventArgs args)
{
    int scrollBarValue = this.radGridView1.TableElement.VScrollBar.Value;
    bool visible = true;
    if (args.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
    {
        visible = false;
    }
    this.radGridView1.MasterTemplate.BeginUpdate();
    for (int i = 1; i < this.radGridView1.Columns.Count; i += 2)
    {
        this.radGridView1.Columns[i].IsVisible = visible;
    }
    this.radGridView1.MasterTemplate.EndUpdate();
    this.radGridView1.TableElement.VScrollBar.Value = scrollBarValue;
}

Unplanned
Last Updated: 14 Aug 2017 10:46 by ADMIN
Use the attached project to reproduce. 
- Start the project and group by any column and export the grid.
- The same code works finme if the document is imported.

Workaround:
Edit the document after it is exported:

var provider = new XlsxFormatProvider();
var workbook = new Workbook();
using (var stream = File.OpenRead(@"D:\123.xlsx"))
{
    workbook = provider.Import(stream);
}

PatternFill solidPatternFill = new PatternFill(PatternType.Solid, System.Windows.Media.Color.FromRgb(46, 204, 113), Colors.Transparent);
CellValueFormat textFormat = new CellValueFormat("@");

Worksheet sheet = workbook.ActiveWorksheet;
CellRange range = new CellRange(0, 0, 1, 4);

CellSelection header = sheet.Cells[range];
if (header.CanInsertOrRemove(range, ShiftType.Down))
{
    header.Insert(InsertShiftType.Down);
}
header.Merge();
header.SetFormat(textFormat);
header.SetFontFamily(new ThemableFontFamily("Rockwell"));
header.SetFontSize(24);
header.SetHorizontalAlignment(Telerik.Windows.Documents.Spreadsheet.Model.RadHorizontalAlignment.Center);
header.SetVerticalAlignment(Telerik.Windows.Documents.Spreadsheet.Model.RadVerticalAlignment.Center);
header.SetFill(solidPatternFill);
header.SetValue("Test");

using (var stream = File.OpenWrite("result.xlsx"))
{
    provider.Export(workbook, stream);
}

Process.Start("result.xlsx");