Text Alignment in a Table - Vertical Alignment

Received : 2007/08/01 14:13:09
Message : Hi,
I was wonderign if you guys have the capability to align text in the middle of a table. Basically see the fuction for text alignment which allows you to have it left, right, center, or justify aligned. I need it to be able to Top, Bottm, or middle align as well.
A vertical alignment option. Is that available? Thanks agian.


This message was posted using Aspose.Live 2 Forum

Dear Crafte,

Below is for Java

Please use TextFrame.setAnchorText methods, the parameter enumeration passed to it are the following

---------------------------------------------------------------------------------

static int BOTTOM

static int BOTTOM_BASELINE

static int BOTTOM_CENTERED

static int BOTTOM_CENTERED_BASELINE

static int MIDDLE

static int MIDDLE_CENTERED

static int TOP

static int TOP_BASELINE

static int TOP_CENTERED

static int TOP_CENTERED_BASELINE

---------------------------------------------------------------------------------

In case, it is .NET, you can use TextFrame.AnchorText read/write property

Can we do right-aligned text in a table cell? If so, how to do it? Thanks,

Paragraph object has an Alignment property which takes the value of TextAlignment enumeration.

TextAlignment Enumeration
Default Default alignment
Left Left alignment
Center Center alignment
Right Right alignment
Justify

For example, if you want to align the text to left, you will do it like this way.

shp.TextFrame.Paragraphs[0].Alignment=TextAlignment.Left;

Also, see this link.

<A href="https://forum.aspose.com/t/102215</A></P>

I’m new to Aspose and one of my first tasks is to create some one-line paragraphs that will be replaced by text as the slide is processed. My question is: Assume that I have some paragraphs on a slide, like so:

A
B
C

If, say, paragraph A can be replaced by more than one line of text, how do I cause the paragraphs below it to shift down so that they don’t overlap, or go off the bottom of the slide? Thanks.

Dear Ken,

I have tried to understand your requirement and generated the code in Java too support your work. Please use the code snippet given bellow to serve purpose.

PresentationEx pres = new PresentationEx("D://Aspose Data//TextReplace.pptx");

SlideEx slide = pres.getSlides().get(0);
ShapeEx shp;
for (int iCount=0; iCount<slide.getShapes ().size();iCount++)
{
shp=slide.getShapes().get (iCount);

if (shp instanceof AutoShapeEx)
{
AutoShapeEx ashp = (AutoShapeEx)shp;

if (ashp.getTextFrame() != null)
{
for (int paracount = 0; paracount < ashp.getTextFrame().getParagraphs().size(); paracount++)
{
ParagraphEx para = ashp.getTextFrame().getParagraphs().get(paracount);
for (int iPort=0;iPort<para.getPortions ().size ();iPort++)
{
PortionEx port= para.getPortions().get(iPort);

port.setText ( ParseValues(port.getText()));

}

}
}


}
}

pres.write("D://Aspose Data//TextReplace_New.pptx");

static String ParseValues(String value)
{
String results = value;
results = results.replace("A", "Welcome to Aspose.Slides");
results = results.replace("B", "Hello world");
results = results.replace("C", "I am Mudassir");
results = results.replace("D", "This is what i wanted");


return results;
}

Thanks and Regards,