I tested the 5.6.16 version of spire.doc.
There are some optimization on the generation but I still have problems with the rendered content.
This is more or less what I do:
- Code: Select all
Document finalDoc = new Document();
for (int i = 0; i < 10; i++)
{
Document doc = new Document();
doc.LoadFromFile("template_spire.docx");
'''' Sorry it's in VB
For Each s As Section In doc.Sections
t = New Table(doc)
r = t.AddRow()
c = r.AddCell()
t.TableFormat.LayoutType = LayoutType.Fixed
t.PreferredWidth = New PreferredWidth(WidthType.Percentage, 100)
While s.Body.ChildObjects.Count > 0
Dim obj As DocumentObject = s.Body.ChildObjects(0)
c.ChildObjects.Add(obj)
End While
For Each p As Paragraph In c.Paragraphs
p.Format.KeepFollow = True
Next
s.Tables.Add(t)
Next
'''' End of VB section
finalDoc.ImportContent(doc, false);
}
finalDoc.SaveToFile(outputPDF,FileFormat.PDF);
finalDoc.Dispose();
The final documents are different and not exactly as it is in the template.
The template and the generated documents are available here: https://www.wetransfer.com/downloads/166e1cdcc82a81fec282a98623b95b8b20160201101244/d7a085bd50987cfc7aa9603b0f169fc120160201101244/a86666