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

Free Support Forum - aspose.com

Tab stop / left indent for table

Hello,


I’m creating a table using document builder. This works fine… Now I want to set a left indent for the table because my document uses a left margin. The table gets generated nearer to the document border than other content.

Thats how I create the table:

DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToMergeField(“ServiceCostsAlt”);

builder.Font.Name = “Arial”;
builder.Font.Size = 10;

BorderCollection borders = builder.CellFormat.Borders;
borders.LineStyle = LineStyle.Single;
borders.LineWidth = 1;

Table objTable = builder.StartTable();

for (int i = 1; i <= iPeriod; i++)
{
string strPID = objParameterServiceCosts.PID.Replace(“n”, i.ToString());
string strCaption = objParameterServiceCosts.GetTranslation().Replace("#", i.ToString());
double dValue = (double)Calculator.getDynamicCalculationParameterValue(objCalculation, strPID, false);

Cell objCell1 = builder.InsertCell();
objCell1.CellFormat.Width = 250;

builder.Write(strCaption);

Cell objCell2 = builder.InsertCell();
objCell2.CellFormat.Width = 100;

builder.Write(dValue.ToString());

builder.EndRow();

}

builder.EndTable();

Hi Sebastian,


Thanks for your inquiry. I think, Table.LeftIndent Property is what you’re looking for. Here is how to use it:

// Set the left indent for the table. Table
wide formatting must be applied after
// at least one row is present in the table.
objTable.LeftIndent = 20.0;

I hope, this will help.

Best Regards,