Hanging Indent In Powerpoint Tables

Anytime I create a table in a powerpoint slide and the text wraps to the second line, the second line is indented. I cannot find the option to turn off the indent. I do not see it in the TextFrame, Paragraph or Portion being added. All of my searches through the API have come up empty.

Hi,

Thank you for considering Aspose.

To reproduce and further investigate your issue, I would request you to please share your sample code and the output file with us. We will check it and get back to you.

Thanks & Regards,

Below is a quick example I put together that illustrates the problem. I have also included a pptx with the table copied into it. There is no first line indent, but there is a hanging indent, even though there are no bullets.


Slide slide = presentation.AddEmptySlide();

Element headerElement = new Element(“h11”, SlideTitle);
SlideGenerator.DrawList(slide, headerElement.ToIEnumerable(), this.TitleDimensions, Color.Black, AnchorText.Bottom);

Table table = slide.Shapes.AddTable(tableXPosition, tableYPosition, tableWidth,
tableHeight,
tableColumns,
tableRows);

// Set column widths
table.SetColumnWidth(0, 1059);
table.SetColumnWidth(1, 700);
table.SetColumnWidth(2, 950);
table.SetColumnWidth(3, 900);
table.SetColumnWidth(4, 900);
table.SetColumnWidth(5, 900);

string[] data = new string[] { “AAAAAAAAA AAAAAAAAAA”, “BBBBBBBBB BBBBBBBBBB”, “CCCCCCCCC CCCCCCCCCC” };

int rowCount = table.RowsNumber;
foreach (string val in data)
{
table.AddRow();

for (int i = 0; i <= 5; ++i)
{
var tf = table.GetCell(i, rowCount).TextFrame;
var paragraph = tf.Paragraphs[0];
paragraph.HasBullet = false;
paragraph.Portions[0].Text = val;
paragraph.Portions[0].FontHeight = 12;
tf.WrapText = true;
}
}

Hi,

Thank you for sharing the details.

Please download and try the latest version of Aspose.Slides for .NET v14.5.0 and try it at you end. I modified your code using the latest version and attached is the resultant file which doesn’t have any indent in the table cells. Please try it and let us know in case you still face any issue.

//Instantiate Presentation class that represents PPTX file

using (Presentation pres = new Presentation())

{

//Access first slide

ISlide sld = pres.Slides[0];

//Define columns with widths and rows with heights

double[] dblCols = { 100, 100, 100, 100, 100 };

double[] dblRows = { 50, 50, 50, 50, 50 };

//Add table shape to slide

ITable tbl = sld.Shapes.AddTable(100, 50, dblCols, dblRows);

//Set border format for each cell

foreach (IRow row in tbl.Rows)

foreach (ICell cell in row)

{

cell.BorderTop.FillFormat.FillType = FillType.Solid;

cell.BorderTop.FillFormat.SolidFillColor.Color = Color.Red;

cell.BorderTop.Width = 5;

cell.BorderBottom.FillFormat.FillType = FillType.Solid;

cell.BorderBottom.FillFormat.SolidFillColor.Color = Color.Red;

cell.BorderBottom.Width = 5;

cell.BorderLeft.FillFormat.FillType = FillType.Solid;

cell.BorderLeft.FillFormat.SolidFillColor.Color = Color.Red;

cell.BorderLeft.Width = 5;

cell.BorderRight.FillFormat.FillType = FillType.Solid;

cell.BorderRight.FillFormat.SolidFillColor.Color = Color.Red;

cell.BorderRight.Width = 5;

}

string[] data = new string[] { "AAAAAAAAA AAAAAAAAAA", "BBBBBBBBB BBBBBBBBBB", "CCCCCCCCC CCCCCCCCCC" };

int rowCount = 0;

foreach (string val in data)

{

for (int i = 0; i < 5; i++)

{

var tf = tbl[rowCount,i].TextFrame;

var paragraph = tf.Paragraphs[0];

paragraph.ParagraphFormat.Bullet.Type = BulletType.None;

paragraph.Portions[0].Text = val;

paragraph.Portions[0].PortionFormat.FontHeight = 12;

tf.TextFrameFormat.WrapText = NullableBool.True;

}

rowCount+=1;

}

//Write PPTX to Disk

pres.Save("d:\\data\\table.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

}

Thanks & Regards,