Document Builder

Hi ALL :

I am using document builder to build a table .

I am having problem in aligning the content in the table to left .
I want all the content in the table to be aligned to left .

The problem is ,indent or alignment of previous paragraph is effecting the table alignment below it

Any help is appreciated .

Hi Jaswanth,

Thanks for your inquiry. Please read following documentation link for your kind reference.
https://docs.aspose.com/words/net/applying-formatting/
https://docs.aspose.com/words/net/applying-formatting/
In your case, I suggest you please use ParagraphFormat.Alignment as Left. Hope this helps you. If you still face problem, please share following detail for investigation purposes.

  • Please attach your input Word document.
  • Please

create a standalone/runnable simple application (for example a Console
Application Project
) that demonstrates the code (Aspose.Words code) you used to generate
your output document

  • Please attach the output Word file that shows the undesired behavior.
  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will
    investigate as to how you are expecting your final document be generated
    like.

As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

Check the sample !!

The indend of the above paragraph is effecting the table below it !!!

Hope you guys come with good solution

The following is the code which i used to build the table .

Document doc = new Document(MyDir + "Test28.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToMergeField("Test1");
// We call this method to start building the table.
builder.StartTable();
builder.InsertCell();
builder.Write("Row 1, Cell 1 Content.");
// Build the second cell
builder.InsertCell();
builder.Write("Row 1, Cell 2 Content.");
// Call the following method to end the row and start a new row.
builder.EndRow();
// Build the first cell of the second row.
builder.InsertCell();
builder.Write("Row 2, Cell 1 Content");
// Build the second cell.
builder.InsertCell();
builder.Write("Row 2, Cell 2 Content.");
builder.EndRow();
// Signal that we have finished building the table.
builder.EndTable();
builder.MoveToMergeField("Test1");
// We call this method to start building the table.
builder.StartTable();
builder.InsertCell();
builder.Write("Row 1, Cell 1 Content.");
// Build the second cell
builder.InsertCell();
builder.Write("Row 1, Cell 2 Content.");
// Call the following method to end the row and start a new row.
builder.EndRow();
// Build the first cell of the second row.
builder.InsertCell();
builder.Write("Row 2, Cell 1 Content");
// Build the second cell.
builder.InsertCell();
builder.Write("Row 2, Cell 2 Content.");
builder.EndRow();
// Signal that we have finished building the table.
builder.EndTable();

Thanks.
Jaswanth

Hi Jaswanth,

Thanks for sharing the code and output document. Could you please attach your input Word document (Test28.docx) here for testing? I will investigate the issue on my side and provide you more information.