Keeptogether

I need to know how can i achieve this , i try to export word document from html and in my html i have some div with specific class like “keeptogether”, i want those div content together in page dont split into two pages.

Sample Html

Sub Content
Sub Content

@hafiz.sohaib.ali,

Thanks for your inquiry. Please note that HTML is not paginated document. When content of HTML grows from the page’s size of Word document, it will be split on the two pages. Could you please share your input HTML document along with expected output Word document here for our reference? We will then provide you more information about your query along with code.

image1.png (169.9 KB)

theses red boxes is represented “Company176_-2”,overall_Company176_-2 and Company176_-3 div i want these div content keep together if you see third div is starting from first page i want this div content with image start automatically from 2nd page because first has not much space to show the whole content.

HHHunt Homes
                                        <td style="padding-left: 2px;">68% Enthusiasm</td>

                                    </tr>
                                </table>
                            </td>
                            <td style="padding-left: 15px;">
                                <table>
                                    <tr style="font-size: 14px;">
                                        <td><a tooltip="buyers" target="_blank" href="https://wosvoc.com/hub/survey.aspx?displaygroup=Company&amp;groupID=176&amp;ST=1:158&amp;SD=04/01/2011&amp;ED=06/30/2011&amp;DD=closedate">Period&nbsp;2:</a></td>
                                        <td style="padding-left: 2px;">33 <span style=''>of 62 (53%)</span></td>

                                        <td style="padding-left: 2px;">85% Enthusiasm</td>

                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </div>
                <img id="Company176_-2_img" width="700" height="300" />
            </div>
            <div id="overall_Company176_-2" class="chart-container prevent-split page-break" showinlist="1">
                <div class="chart-heading">Overall </div>
                <div class="chart-periods">
                    <table>
                        <tr></tr>
                    </table>
                </div>
                <img id="overall_Company176_-2_img" width="700" height="300" />

            </div>
            <div id="Company176_-3" class="chart-container" style="height:auto" showinlist="1">
                <div class="chart-heading">HHHunt Homes </div>
                <div class="chart-periods">
                    <table>
                        <tr>


                            <td style="padding-left: 15px;">
                                <table>
                                    <tr style="font-size: 14px;">
                                        <td><a tooltip="buyers" target="_blank" href="https://wosvoc.com/hub/survey.aspx?displaygroup=Company&amp;groupID=176&amp;ST=1:158&amp;SD=01/01/2011&amp;ED=03/31/2011&amp;DD=closedate">Period&nbsp;1:</a></td>
                                        <td style="padding-left: 2px;">28 <span style=''>of 41 (68%)</span></td>

                                        <td style="padding-left: 2px;">68% Enthusiasm</td>

                                    </tr>
                                </table>
                            </td>


                            <td style="padding-left: 15px;">
                                <table>
                                    <tr style="font-size: 14px;">
                                        <td><a tooltip="buyers" target="_blank" href="https://wosvoc.com/hub/survey.aspx?displaygroup=Company&amp;groupID=176&amp;ST=1:158&amp;SD=04/01/2011&amp;ED=06/30/2011&amp;DD=closedate">Period&nbsp;2:</a></td>
                                        <td style="padding-left: 2px;">33 <span style=''>of 62 (53%)</span></td>

                                        <td style="padding-left: 2px;">85% Enthusiasm</td>

                                    </tr>
                                </table>
                            </td>

                        </tr>
                    </table>
                </div>
                <img id="Company176_-3_img" width="700" height="300" />
            </div>
Period 1: 28 of 41 (68%)

@hafiz.sohaib.ali,

Thanks for sharing the detail. Unfortunately, Aspose.Words doesn’t have a counterpart for html DIV element. We suggest you please put your HTML content into HTML table and use the code example shared in following article to get the desired output. Hope this helps you.
Keeping Tables and Rows from Breaking across Pages