We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Giving zero intent for inner cell Indent

I am trying to create inner cells in pdf with using aspose words. But I have issues about its style. I need to center and fit my text in cell. But when I set center property for cell it gives some padding automatically.

I made a sample with MS word as below image:

This one is that I have created programmatically with using aspose.words.

As you can see it doesn’t fit when I set center property true for columns. My inner cell import code is below:

Cell cell = table.Rows[j].Cells[i];
cell.CellFormat.RightPadding = 0;
foreach (Paragraph pf in cell.Paragraphs)
{
     pf.ParagraphFormat.LeftIndent = 0;
}
cell.CellFormat.WrapText = false;
builder.MoveTo(cell.FirstParagraph);

builder.InsertCell();
builder.Writeln(tr.Rows[j][i].Value);
builder.EndTable();

Which property should I set to fit it in cell, thanks.

Hi Ahmet,

Thanks for your inquiry. Please try following code example and let us know how it goes on your side. The shared images are not visible. Could you please share your input and expected output documents here for our reference? We will then provide you more information on this along with code.

Document doc = new Document(MyDir + "in.docx");
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
Cell cell = table.FirstRow.FirstCell;
cell.CellFormat.RightPadding = 0;
cell.CellFormat.LeftPadding = 0;
cell.CellFormat.WrapText = true;
foreach (Paragraph pf in cell.Paragraphs)
{
    pf.ParagraphFormat.Alignment = ParagraphAlignment.Center;
}
doc.Save(MyDir + "Out.docx");