We are inserting HTML code from HTML file into word document. Problem is that table is exceeding page and even when we set table to “autofit to window” in generated word document (manually in office), width is not corrected. Please find screenshot and files used
public static void InsertHTML(String FileOut)
{
StreamReader sr = new StreamReader(@"C:\Users\raja_c\Downloads\temp table.html");
String html = sr.ReadLine();
html= html+ sr.ReadLine();
sr.Close();
Document doc = new Document();
DocumentBuilder db = new DocumentBuilder(doc);
db.ParagraphFormat.Alignment = ParagraphAlignment.Center;
db.Writeln("Tables");
db.InsertHtml(html);
doc.Save(FileOut);
}
image.png (5.4 KB)
tables.zip (8.4 KB)