Free Support Forum - aspose.com

Setting superscript property to a part of a word within the same cell

Hi,

I have a problem in making a part of the value, set for a cell, as the super script of the remaining characters in the value of the cell.

For example, if I set "12345" as the value in the cell as cell.setValue("12345"), I want '45' to become the superscript of '123' inside the same cell. Please help me to get through this problem. Thanks.

Karups.


This message was posted using Page2Forum from Dealing with Font Settings - Aspose.Cells for Java

Hi,

Please refer to the following sample code for your requirement:

Sample code:

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

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

//Adding some value to the “A1” cell
Cell cell = cells.getCell(“A1”);
cell.setValue(“12345”);

Font font = new Font();
font.setEscapement(Font.ESCAPEMENT_SUPERSCRIPT);

//Setting the font of selected characters
cell.setCharacters(3, 2, font);

//Saving the Excel file
workbook.save(“e:\files\supersecriptoutput2.xls”,FileFormatType.DEFAULT);


Thank you.

Hi Amjad,

Thanks for the response. Its working fine with our application.

Thanks & Regards,

Karups