Aspose::Cells::Row class

Row class

Represents a single row in a worksheet.

class Row

Methods

MethodDescription
ApplyStyle(const Style& style, const StyleFlag& flag)Applies formats for a whole row.
CopySettings(const Row& source, bool checkStyle)Copy settings of row, such as style, height, visibility, …etc.
Equals(const Row& row)Checks whether this object refers to the same row with another row object.
Get(int32_t column)Gets the cell.
GetCellByIndex(int32_t index)Get the cell by specific index in the cells collection of this row.
GetCellOrNull(int32_t column)Gets the cell or null in the specific index.
GetEnumerator()Gets the cells enumerator.
GetEnumerator(bool reversed, bool sync)Gets an enumerator that iterates cells through this row.
GetFirstCell()Gets the first cell object in the row.
GetFirstDataCell()Gets the first non-blank cell in the row.
GetGroupLevel()Gets the group level of the row.
GetHasCustomStyle()Indicates whether this row has custom style settings(different from the default one inherited from workbook).
GetHeight()Gets and sets the row height in unit of Points.
GetIndex()Gets the index of this row.
GetLastCell()Gets the last cell object in the row.
GetLastDataCell()Gets the last non-blank cell in the row.
GetStyle()Gets the style of this row.
IsBlank()Indicates whether the row contains any data.
IsCollapsed()whether the row is collapsed
IsHeightMatched()Indicates whether the row height matches current default font setting of the workbook. True of this property also denotes the row height is “automatic” without custom height value set by user.
IsHidden()Indicates whether the row is hidden.
IsNull() constChecks whether the implementation object is nullptr.
explicit operator bool() constoperator bool()
operator=(const Row& src)operator=
Row(Row_Impl* impl)Constructs from an implementation object.
Row(const Row& src)Copy constructor.
SetGroupLevel(uint8_t value)Gets the group level of the row.
SetHeight(double value)Gets and sets the row height in unit of Points.
SetIsCollapsed(bool value)whether the row is collapsed
SetIsHeightMatched(bool value)Indicates whether the row height matches current default font setting of the workbook. True of this property also denotes the row height is “automatic” without custom height value set by user.
SetIsHidden(bool value)Indicates whether the row is hidden.
SetStyle(const Style& style)Sets the style of this row.
~Row()Destructor.

Fields

FieldDescription
_implThe implementation object.

Examples

Aspose::Cells::Startup();
//Instantiating a Workbook object
Workbook workbook;

//Obtaining the reference of the first worksheet
Worksheet worksheet = workbook.GetWorksheets().Get(0);
Style style = workbook.CreateStyle();

//Setting the background color to Blue
style.SetBackgroundColor(Color{ 0xff, 0, 0, 0xff });

//Setting the foreground color to Red
style.SetForegroundColor(Color{ 0xff, 0xff, 0, 0 });

//setting Background Pattern
style.SetPattern(BackgroundType::DiagonalStripe);

//New Style Flag
StyleFlag styleFlag;

//Set All Styles
styleFlag.SetAll(true);

//Get first row
Row row = worksheet.GetCells().GetRows().Get(0);
//Apply Style to first row
row.ApplyStyle(style, styleFlag);

//Saving the Excel file
workbook.Save(u"book1.xls");
Aspose::Cells::Cleanup();

See Also