Spread Windows Forms 17
Spread Windows Forms 17.0 Product Documentation / Developer's Guide / Spreadsheet Objects / Object Parentage
In This Topic
    Object Parentage
    In This Topic

    For the objects in the Spread component, such as the sheet, column, and cell, there are formatting and other properties that each object inherits from what is called its "parent." A cell may inherit some formatting, for example the background color, from the sheet. If you set the alignment of text for all the cells in a column, the cell inherits that as well. Because of this object parentage, many properties and methods can be applied in different ways to different parts of a spreadsheet.

    Of course, you can override the formatting that an individual cell inherits. But by default, objects inherit properties from their parents. So in a given context, the settings of any object are the composite of the settings of its parents that are being applied to that object. For example, you may set the text color for a cell at the cell level, but it may inherit the vertical alignment from the row and the border from its column, and the background color from the sheet. Since the background color may be set at several of these levels, certain rules of precedence must apply.

    The closer to the cell level, the higher the precedence. So if you set the background color of the cell, the settings inherited from the parents are overridden. Refer to the list to see the order of precedence of these properties. The closer to the cell (the lower the number) the higher the precedence.

    1. Cell
    2. Row
    3. Column
    4. Alternating Row
    5. Sheet
    6. Component

    Although formatting and other attributes inherit the object from its "parent", the values of the properties of the individual objects themselves are not updated.For example, even if you change the text color (ForeColor property) of a column (Column class) to red ("Red"), the value of the ForeColor property of the cell (Cell class) on that column does not change by its own.If you want to check the formatting etc. that will eventually be applied to the cell, you can use GetStyleInfo method of SheetView class.

    See Also