Tables are overlap each other

Hi Support,

I am using the Aspose.Words.I am facing the poblem that the table are oveflow over each other

when i set the property TextWrappin.Arround. I have a four table one after the another. Any help is appreciated.

NodeCollection new Tablecollections = builder.CurrentSection.GetChildNodes(NodeType.Table, true);
for (int i = 0; i < new Tablecollections.Count; i++)
{ 
    //Aspose.Words.Tables.Table t in newTablecollections)
    Aspose.Words.Tables.Table t = (Aspose.Words.Tables.Table)new Tablecollections[i];
    t.Alignment = TableAlignment.Right;
    t.PreferredWidth = PreferredWidth.FromPoints(330);
    t.TextWrapping = TextWrapping.Around;
}

Thanks,

This message was posted using Email2Forum by Tilal Ahmad Sana.

Hi,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  1. Your input Word document you’re getting this problem with.
  2. The Aspose.Words generated output document which shows the undesired behavior.
  3. Please create a standalone/runnable simple console application that helps me reproduce your problem on my end and attach it here for testing.

As soon as you get these pieces of information ready for me, I’ll start investigation into your issue and provide you more information.

Best regards,

Hi i this are the my input output & desired output , i have the mail marge field that i have replaced with the image & text at the time of Generation of docx.
in the input document

«PopChart1» //this is image
«PopGraph1» this is image
«PopChart2» this is image
«PopReport1»//This is a Text Field 
«PopGraph2» this is image
«PopReport2» This is Text Field

Hi,

Thanks for sharing your documents and sorry for the delayed response. Perhaps, you could use Shape.WrapType property to specify how text should be wrapped around a shape or picture. Unfortunately, it is difficult to say what the exact problem is without sample console application. Please create a sample project that demonstrates this issue and attach it here for testing. We will investigate the issue further and provide you more information. Thanks for your cooperation.

Best regards,

hi Awais ,
Thanks for your reply.
Here is the Console Application & the output document . the generated output have 4 images due to overlapping all images are not shown.
please suggest me a best way so i can generate a same document as of my output document.
Hi in the console application i use dll download using a nuget not the licensed .

Hi,

Thanks for the additional information. We will check this scenario and get back to you soon (please expect a reply within next 24 hours). Sorry for the delay.

Best regards,

Hi,

Thanks for being patient. You need to specify WrapType value as “Tight” and adjust the Left and Top positions of images. I have attached a couple of sample documents here for your reference. Please try executing the following code to achieve what you’re looking for:

Document doc = new Document(@"C:\Temp\Geo_PopulationCharacteristics.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
PageSetup ps = doc.FirstSection.PageSetup;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Justify;
// build report 1
builder.MoveToMergeField("PopReport1");
builder.Write("At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.");
builder.MoveToMergeField("PopChart1");
Shape img1 = builder.InsertImage(@"C:\Temp\table1.jpg");
img1.WrapType = WrapType.Tight;
img1.Left = ps.PageWidth - ps.LeftMargin - ps.RightMargin - img1.Width;
builder.MoveToMergeField("PopGraph1");
Shape img2 = builder.InsertImage(@"C:\Temp\Chart1.jpg");
img2.WrapType = WrapType.Tight;
img2.Left = ps.PageWidth - ps.LeftMargin - ps.RightMargin - img1.Width;
img2.Top += img1.Height;
//build report 2
builder.MoveToMergeField("PopReport2");
builder.Write("But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?");
builder.MoveToMergeField("PopChart21");
Shape img3 = builder.InsertImage(@"C:\Temp\chart2.jpg");
img3.WrapType = WrapType.Tight;
img3.Left = ps.PageWidth - ps.LeftMargin - ps.RightMargin - img1.Width;
doc.Save(@"c:\Temp\out.docx");

I hope, this helps.

Best regards,