How to make particular word bold in the cell

Hi,

We are using Aspose cell for JDK1.4 in our application.

We have a requirement to make particular word Aspose.jpg (8.6 KB)
BOLD in cell. Attached here the example.

I tried to find it out in Aspose documentation but not able to.

Pls let us know how to achieve it.

Thanks,
Uttam K.

@Uttam_Kumar

Thanks for considering Aspose APIs.

Please see the following sample code and its generated Excel file. Please also see the documentation article for your reference.

Java

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Accessing the worksheet in the Excel file
Worksheet worksheet = workbook.getWorksheets().get(0);
Cells cells = worksheet.getCells();

//Adding some value to the "B4" cell
Cell cell = cells.get("B4");
cell.setValue("Visit Aspose!");

Font font = cell.characters(6, 7).getFont();

//Setting the font of selected characters to bold
font.setBold(true);

//Setting the font color of selected characters to blue
font.setColor(com.aspose.cells.Color.getBlue());

//Saving the Excel file     
workbook.save("output.xlsx");

Download Output Excel File:
output Excel file.zip (5.6 KB)

Hi Shakeel,
Thanks for the prompt reply!!!

I tried above code but it seems the method is not supported.

Aspose.jpg (11.8 KB)

Regards,
Uttam K.

@Uttam_Kumar,

Since you might be using some older version for which we cannot help you much. We evaluate issues and help our clients based on latest APIs set only. Anyways, we think you may try to use Cell.setCharacters() method which I think would be available in your older version, see the code segment for your reference that might work with your older version:
e.g
Sample code:

Font myfont = new Font();
myfont.setColor(Color.BLUE);
myfont.setBold(true);
cell.setCharacters(6,7, myfont);

Hope, this helps a bit.

Hi Amjad,
This is working fine. Thanks!!!

Regards,
Uttam K.

@Uttam_Kumar,

Good to know that your issue is sorted out by the suggested code. Feel free to contact us if you have further comments or questions, we will be happy to assist you soon.

Thank you.