Cells Formatting

Format Cell or Range of Cells

If you want to format cell or range of cells, then Aspose.Cells provides the Style class. You can accomplish all the formatting of the cell or range of cells using this class. Some of the things relating to formatting that can be accomplished with IStyle class are following

  • Set fill color of the cell
  • Set the text wrap of the cell
  • Set the borders of the cells like the top, left, bottom and right borders, etc.
  • Set the font color, font size, font name, strike, bold, italic, underline, etc.
  • Set the text horizontal or vertical alignment to right, left, top, bottom, center, etc.

If you want to set the style of a single cell then please use Cell->SetStyle() method and if you want to set the style of a range of cells, then please use Range->ApplyStyle() method.

Sample Code

The following sample code formats the cell C4 of the worksheet in various ways and the screenshot shows the output excel file generated by it for your reference.

todo:image_alt_text