Hello,
Is it possible to set two different text styles in one cell ?
Thanks,
Marc.
Hi Marc,
Please check http://www.aspose.com/Products/Aspose.Excel/Api/Aspose.Excel.Cell.Characters.html
for reference.
@CENCEP,
Aspose.Cells has replaced Aspose.Excel that is no more continued and discarded. You can set different styles for text in a single cell using Aspose.Cells as this new product is much advanced and feature rich. Here is the example that demonstrates this feature:
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Obtaining the reference of the first(default) worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];
// Accessing the "A1" cell from the worksheet
Cell cell = worksheet.Cells["A1"];
// Adding some value to the "A1" cell
cell.PutValue("Visit Aspose!");
// Setting the font of selected characters to bold
cell.Characters(6, 7).Font.IsBold = true;
// Setting the font color of selected characters to blue
cell.Characters(6, 7).Font.Color = Color.Blue;
// Saving the Excel file
workbook.Save(dataDir + "book1.out.xls");
Refer to the following article for more information about formatting the cells.
Data Formatting
For testing this code, get a free trial version here:
Aspose.Cells for .NET (Latest Version)
A comprehensive project is available here which contains hundreds of ready to run examples for testing different features of this product.