Highlight Text- Vertical align- hide table border- fit text to shape

Hi,
I have few queries with text management.

1. Is it possible to highlight text in a Portion.
ie: some thing like
Portion p1 = new Portion("highlight demo");
p1.setHightlightColor(Color.YELLOW);
p1.setHightlight(true);

2. How can I vertical align - top/bottom align- contents inside a Rectangle shape?

3. How can I hide table border? table.getLineFormat() return null for me, which prevent me doing table.getLineFormat().setShowLines(false);

4. Is it possible to fit text to shape? similar to setFitShapeToText - I am looking for setFitTextToShape

-Muhammed

Hi Muhammed,

For 1 & 2:

An issue with issue id 13427 has been created to incorporate the featues. This thread has been linked to this issue. You will get an automated notification in this thread as soon as these features are incorporated.

For 3:

Use Table.setBorders(width,color) method with width=0 to hide border.

For 4:

Use TextFrame.fitTextToShape() mehtod for this.

Hi Muhammed,

I have prepared an example for verticle alignment of text. It also fills the text frame with some color, however, it does not achieve the text highlight requirement in one text frame. As a workaround, you can use different text frames for the texts to be highlighted by filling those TextFrames with some color and using TextFramr.setFitShapeToText(true) method.

Presentation pres=new Presentation();

Slide slide=pres.getSlideByPosition(1);

com.aspose.slides.Rectangle bitName = slide.getShapes().addRectangle(1000, 1000, 1000, 500);

TextFrame bitNameTF = bitName.addTextFrame("Some Text");

bitNameTF.setMarginTop(0);

bitNameTF.setMarginLeft(2);

bitNameTF.setMarginBottom((float)12);

bitNameTF.getLineFormat().setShowLines(true);

com.aspose.slides.Paragraph bitPara2 = bitNameTF.getParagraphs().get(0);

bitPara2.setAlignment(TextAlignment.RIGHT);

Portion bitPort2 = bitNameTF.getParagraphs().get(0).getPortions().get(0);

bitPort2.setFontColor(java.awt.Color.blue);

bitPort2.setFontHeight((short)15);

bitNameTF.getFillFormat().setType(FillType.SOLID);

bitNameTF.getFillFormat().setForeColor(java.awt.Color.YELLOW);

pres.write("TextAlign.ppt");