Free Support Forum - aspose.com

Adding a Symbol into a table cell

Hi,
I created a table in a slide using Aspose slides for java.
How can I add into cell table a symbol?

For example: Wingdings 3 , character code 00CC

Thanks,
Yair

@yaird,

I have observed your requirements and suggest you to please try using following sample code.

public static void TestSpecialChar()
{
    Presentation pres=new Presentation();
    ISlide slide=pres.getSlides().get_Item(0);
    IAutoShape ashp=slide.getShapes().addAutoShape(ShapeType.Rectangle, 50, 100, 100, 100);
    ITextFrame text=ashp.addTextFrame("");
    IPortion portion=new Portion();
    portion.getPortionFormat().setLatinFont(new FontData("Wingdings 3"));
     String string = "\u00CC";
    try 
    {
      // Convert from Unicode to UTF-16

      byte[] utf16 = string.getBytes("UTF-16");

      // Convert from UTF-8 to Unicode
      string = new String(utf16, "UTF-16");
    } 
    catch (UnsupportedEncodingException e) 
    {

    }

    portion.setText(string);

    text.getParagraphs().clear();

    Paragraph para=new Paragraph();
    para.getPortions().add(portion);
    text.getParagraphs().add(para);
    pres.save("//users//mudassir//desktop//saved.pptx", SaveFormat.Pptx);

}

Thank you for the quick respond.
The was helpfull.

Thanks,

Yair

Hi,

How to give a color to the symbol added to a table cell by using above code? in my case symbol and the content of the cell should have different colors.

Thanks in advance.

Regards,
Venkat.

@sagar465,

The text related properties including fonts, it’s color, height and italicizing is set on portion level. I suggest you to please visit this documentation link for your kind reference.

Thanks a lot. this helped to solve the issue:)