This project has moved. For the latest updates, please go here.

Tables and paragraphs out of sequence

Aug 27, 2012 at 8:39 PM

Love Docx.dll but am encountering an issue today. It is putting all the Tables before the single Image header and multiple Paragraphs, in defiance of the order in which I am adding them to the document.

My C# basically does this when creating a document:

//Add an image header
Novacode.Image img = document.AddImage( "Header.JPG");
Paragraph pImage = document.InsertParagraph("", false);
pImage.InsertPicture(img.CreatePicture());

foreach (Agency in Agencies)

//Add some descriptive text in a Paragraph
Paragraph pAgency = document.InsertParagraph();
pAgency.Append(rowAgency.AgencyNamePublic).Bold().FontSize(14); 

//Add an address in a Table 
Novacode.Table tblAgency = document.InsertTable(2, 1);
tblAgency.AutoFit = AutoFit.Window; 

tblAgency.Rows[0].Cells[0].Paragraphs.First().Append(rowAgency.PhysicalAddress1.Trim()).Bold(); 
tblAgency.Rows[1].Cells[0].Paragraphs.First().Append(strCityProvincePostal).Bold();

}

Then the output of this has all the address Tables showing at the top of the document, even before the image header (that was added before the foreach loop) and also before all of the description Paragraphs (also added before the address Table for each Agency record). 

Am I missing some method perhaps that actually commits the Image and Paragraphs to the document? 

Developer
Aug 27, 2012 at 10:36 PM

Recompile binary from newest source. There is a bug in released binary as far as I remember. It should solve your problem.

Aug 28, 2012 at 1:31 AM

Thanks – that worked!

From: MadBoy [email removed]
Sent: Monday, August 27, 2012 2:36 PM
To: neil@mckfamily.com
Subject: Re: Tables and paragraphs out of sequence [DocX:393247]

From: MadBoy

Recompile binary from newest source. There is a bug in released binary as far as I remember. It should solve your problem.