GemBox.Spreadsheet

ExcelFile.RowColumnResolutionMethod Property

Gets or sets the CellStyle resolution method.

public RowColumnResolutionMethod RowColumnResolutionMethod {get; set;}

Remarks

Because of limitations of Microsoft Excel file format, every cell must be written to file with resolved CellStyle. In the case where a cell doesn't have specific property set on its Style and that property is set on both row and column that contain that cell, a cell will inherit property value from row or column Style, depending on the resolution method.

Default value for this property is RowOverColumn.

Example

Following code will result in a file where cell will have right alignment because same column cell style property takes precedence over row cell style property. Note that resolution is property based, in other words if column in this case had VerticalAlignment set cell would inherit both HorizontalAlignment and VerticalAlignment from row and column.

[Visual Basic]
    excelFile.RowColumnResolutionMethod = RowColumnResolutionMethod.ColumnOverRow
    excelFile.Worksheets(0).Cells("B2").Value = "B2"
    excelFile.Worksheets(0).Rows("2").Style.HorizontalAlignment = HorizontalAlignmentStyle.Center
    excelFile.Worksheets(0).Columns("B").Style.HorizontalAlignment = HorizontalAlignmentStyle.Right
[C#]
    excelFile.RowColumnResolutionMethod = RowColumnResolutionMethod.ColumnOverRow;
    excelFile.Worksheets[0].Cells["B2"].Value = "B2";
    excelFile.Worksheets[0].Rows["2"].Style.HorizontalAlignment = HorizontalAlignmentStyle.Center;
    excelFile.Worksheets[0].Columns["B"].Style.HorizontalAlignment = HorizontalAlignmentStyle.Right;

See Also

ExcelFile Class | GemBox.Spreadsheet Namespace