Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Apply different kinds of formatting styles on cells to set background or foreground colors, borders, fonts, horizontal and vertical alignments, indentation level, text direction, rotation angle and much more.
If developers need to apply different formatting styles to different cells then it’s better to get the Style of the cell using Cell.GetStyle method, specify the style attributes and then apply the formatting using Cell.SetStyle method. An example is given below to demonstrate this approach to apply various formatting on a cell.
If developers need to apply the Same formatting style to different cells then they can use Style object. Please follow the steps below to use the Style object:
This approach can greatly improve the efficiency of your applications and save memory too.
If you need to apply different formatting styles for Microsoft Excel 2007, apply styles using the Aspose.Cells API. An example is given below to demonstrate this approach to apply a predefined style on a cell.
Dealing with Font Settings explains how to format text in cells, but it only explains how to format all of the cell content. What if you want to format only selected characters?
Aspose.Cells supports this feature too. This topic explains how to we use this feature effectively.
Aspose.Cells provides a class, Workbook that represents a Microsoft Excel file. The Workbook class contains the Worksheets collection that allows access to each worksheet in an Excel file. A worksheet is represented by the Worksheet class. The Worksheet class provides a Cells collection. Each item in the Cells collection represents an object of the Cell class.
The Cell class provides the Characters method that takes the following parameters to select a range of characters inside a cell:
The Characters method returns an instance of the FontSetting class that allows developers to format the characters in the same way as they would a cell as shown below in the code example. In the output file, in the A1 cell, the word ‘Visit’ will be formatted with the default font but ‘Aspose!’ is bold and blue.
Sometimes, developers need to apply the same formatting on rows or columns. Applying formatting on cells one by one often takes longer and is not a good solution. To address this issue, Aspose.Cells provides a simple, fast way discussed in detail in this article.
Aspose.Cells provides a class, the Workbook that represents a Microsoft Excel file. The Workbook class contains a Worksheets collection that allows access to each worksheet in the Excel file. A worksheet is represented by the Worksheet class. The Worksheet class provides a Cells collection. The Cells collection provides a Rows collection.
Each item in the Rows collection represents a Row object. The Row object offers the ApplyStyle method used to set the row’s formatting. To apply the same formatting to a row, use the Style object. The steps below show how to use it.
The Cells collection also provides a Columns collection. Each item in the Columns collection represents a Column object. Similar to a Row object, the Column object also offers the ApplyStyle method for formatting a column.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.