Reduce Column size in a Table

Consider WE have 4 columns in a table ,I want first two Columns to be wider whereas last two column Should be small.

But I am unable to Reach that,I get all the four columns in same width.Please help me on this.

Code Sample:

if (i == 0)
    builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(70);
else if (i == 1)
    builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(70);
else if (i == 2)
    builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(5);
else
    builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(5);
builder.CellFormat.Width = 118;

@NanthiniSenthil123 In your code you specify both PreferredWidth and Width. It is not recommended to set Width property. Please see the following code, that produces the result you would like to get:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.StartTable();
for (int j = 0; j < 5; j++)
{
    for (int i = 0; i < 4; i++)
    {
        builder.InsertCell();
        builder.Write(string.Format("Cell {0}, {1}", j, i));

        if (i == 0)
            builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(50);
        else if (i == 1)
            builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(30);
        else if (i == 2)
            builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(10);
        else
            builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(10);
    }
    builder.EndRow();
}
builder.EndTable();

doc.Save(@"C:\Temp\out.docx");

Please see the following article to learn more about setting cell and table width.

Hi,
I used above Code,but if i use only preffered width without using width,I am getting following output.

Code used:

        if (i == 0)
            builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(50);
        else if (i == 1)
            builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(30);
        else if (i == 2)
            builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(10);
        else
            builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(10);
    }
    builder.EndRow();
}

Aspose Output.docx (14.6 KB)

@NanthiniSenthil123 Here is the output produced by the code I have provided in my previous answer: out.docx (7.3 KB)
As you can see the output looks correct.

Could you please create a simple console application that will allow us to reproduce the problem? We will check the issue and provide you more information.