Decrease Font Size & Row Heights to Fit Multiple HTML Tables in a Page of Word Document using C# .NET

Hi
I am trying to fit multiple html tables onto a single page however when converting the document splits the html onto two pages. All I want is to put them together on the same A4 page shrunk to fit.

Thanks in advance

@MatthewZ,

Please ZIP and upload your simplified input HTML file and Aspose.Words generated document showing the undesired behavior here for testing. We will then investigate the issue on our end and provide you more information.

Hi
I dont have any, you just need two tables which would not fit on a page and somehow I need them to fit onto a single page. It is that simple.

@MatthewZ,

You can decrease Font size of all Run nodes inside Table. You can also decrease the Row heights of these tables to get the desired result.

Table tab = doc.FirstSection.Body.Tables[0];
foreach (Row row in tab.Rows)
{
    row.RowFormat.Height = 10 * 72;
    foreach (Run run in row.GetChildNodes(NodeType.Run, true))
    {
        run.Font.Size = 6;
        run.ParentParagraph.ParagraphBreakFont.Size = 6;
    }
}

Thank you I will give it a try and if I cant figure it out I will produce an example for you to see what I am experiencing.

@MatthewZ,

Sure, please let us know if you have any troubles and we will be glad to look into this further for you.

Hi
This doesnt work for me as it can be any length and pictures etc.

I basically need to fit all html passed onto a single word page with the “fit” to size set on an A3 landscape document and on an A4 page without playing with html settings.

@MatthewZ,

HTML documents can vertically grow unlimitedly but MS Word documents have a maximum vertical height limit of 22 inches. Please ZIP and attach your input HTML document and the expected Word document showing the correct output here for testing. You can create expected document by using MS Word. Please also list the steps that you performed in MS Word to create expected document. We will then investigate the scenario on our end and provide you more information.