hi can anybody tell me how to add Tabs between two Portion of paragraph of rectangle. i want like template. and two portions shouldbe different color first one is red and second one is black color…
but i want tabs between two portions like template.
Dear mrkumar,
Just add tab character in your first portion text.
e.g
Presentation pres = new Presentation();
Slide sld = pres.GetSlideByPosition(1);
Aspose.Slides.Rectangle rect = sld.Shapes.AddRectangle(100, 100, 3000, 2000);
rect.LineFormat.ShowLines = false;
TextFrame tf = rect.AddTextFrame("");
tf.WrapText = true;
Paragraph para = tf.Paragraphs[0];
Portion firstPort = para.Portions[0];
firstPort.FontColor = Color.Red;
firstPort.Text = "Red\t";
Portion secondPort = new Portion(firstPort);
secondPort.FontColor = Color.Blue;
secondPort.Text = "Blue";
para.Portions.Add(secondPort);
pres.Write("c:\\outPorts.ppt");
hi faiz,
when i add \t to the first text the second line is comming from first character. but i want thet should be the left aligned to second text like following
description this is descriptiondetails
and this should be left aligned ///here text is comming from first character
but do not start from first character
Dear mrkumar,
You can achieve such a thing using a table. Please see the code below and its output attached by me.
Presentation pres = new Presentation();
Slide sld = pres.GetSlideByPosition(1);
Table tbl = sld.Shapes.AddTable(100, 100, 4000, 2000, 2, 1, 0, Color.Beige);
tbl.SetColumnWidth(0, 1000);
TextFrame tf = tbl.GetCell(0, 0).TextFrame;
Portion port = tf.Paragraphs[0].Portions[0];
port.Text = "Description:";
port.FontHeight = 18;
port.FontBold = true;
tf = tbl.GetCell(1, 0).TextFrame;
port = tf.Paragraphs[0].Portions[0];
port.Text = "This is some description.This is some description.This is some description.This is some description.This is some description.This is some description.This is some description.";
port.FontHeight = 18;
//port.FontBold = true;
pres.Write("c:\\outDescription.ppt");