Format Worksheet Cells in a Workbook

Data Formatting

Formatting is used to distinguish between different types of information and to display data clearly.

A format represents a style and is defined as a set of characteristics, such as fonts and font sizes, number formats, cell borders, cell shading, indentation, alignment, and text orientation. Borders provide further ways to highlight information. A border is a line drawn around a cell or a group of cells.

Number formats also make data more meaningful. By applying different number formats, you can change the appearance of numbers without changing the underlying value.

Aspose.Cells for Python via .NET provides the ability to draw borders around cells and ranges easily. It also lets you apply fonts and shade cells. The component is efficient enough that you can format a complete row or column, set alignments, wrap and rotate text in cells. Aspose.Cells for Python via .NET further supports all number formats available in Microsoft Excel.

This article shows how to create a console application in Visual Studio .NET that generates an annual sales report. The workbook is created from scratch, then data is inserted and the worksheet is formatted. We show how to create a simple console application that creates an Excel workbook (you can also use a template file), inserts sales data into the first worksheet, formats the data, and saves an Excel file.

Process

Below are the steps involved in creating a spreadsheet and formatting different cells in various rows and columns of a worksheet.

  1. Download and install Aspose.Cells.
  2. Add the following code to the project folder.