We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Please help ...Need to break Table rows correctly

Below is a part of my html page which i will convert to pdf.

My requirement is whatever inside the



should comes inside one page.
But its splitting across page when page is filled.
what i need is , if page is filled , then those code block should move to next page


Please help on this.


















Oven(s)

Satisfactory


















ID Number: 1212












Maker: quincy lab

















Oven(s)

Satisfactory


















ID Number: 1212












Maker: quincy lab

















Oven(s)

Satisfactory


















ID Number: 1212












Maker: quincy lab

















Oven(s)

Satisfactory


















ID Number: 1212












Maker: quincy lab

















Oven(s)

Satisfactory


















ID Number: 1212












Maker: quincy lab

















Oven(s)

Satisfactory


















ID Number: 1212












Maker: quincy lab

















Oven(s)

Satisfactory


















ID Number: 1212












Maker: quincy lab

















Oven(s)

Satisfactory


















ID Number: 1212












Maker: quincy lab




Hi Sangeetha,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does.

sangeethasanthosh:

what i need is , if page is filled , then those code block should move to next page

As per my understanding, you want to convert Html to Pdf in one page. Do you want to remove the contents of second page? Could you please share some more detail about moving code blocks to next page?

Please manually create a Word document using Microsoft Word that shows the expected output and attach it here for our reference. We will investigate how you want your final output document be generated like. We will then provide you more information about your query along with code.

Hi Tahir,


Thanks for your quick response.

i have attached a text file, which contains my html content, sample only. please view it as a html page. In that , you can see Different models and its related bulleted items under each model.

What i do is, i convert this entire html into aspose.word document and then it into pdf.

i mean i am generating a pdf report from this html .

My issue is, when i convert it into pdf, in some cases, model (html row) will come in the end of a page and its items coming to next page. i want to stop coming like that. if there is no space for its items in the current page, then model row should come down along with its items.

means whatever inside and , this should display together in one page, if not space, then should move to next page.

Please help me on this.

Thanks,
Sangeetha

Hi Sangeetha,

Thanks for sharing the detail. Please use the following code example to achieve your requirements. Following code example shows how to disable rows breaking across pages for every row in a table.


Document
doc = new Document(MyDir

  • “in.html”);

foreach (Table table in doc.GetChildNodes(NodeType.Table, true))

// Disable breaking across pages for all rows in the table.

foreach (Row row in table.Rows)

row.RowFormat.AllowBreakAcrossPages = false;

doc.Save(MyDir + "Out.pdf");


<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:DoNotShowPropertyChanges/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>AR-SA</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>
I suggest you please read following documentation link for your kind reference. Hope this helps you.
http://www.aspose.com/docs/display/wordsnet/Keeping+Tables+and+Rows+from+Breaking+across+Pages

Thats not my requirement

Hi Sangeetha,

I have attached the input and output documents with this post for your kind reference. I have modified input html and add some more rows to test this scenario.

Could you please share some more detail about your requirements what exact you want to achieve using Aspose.Words along with following detail?


  • Please attach your input HTML which contain the rows between and tags and display in two pages.
  • Please manually create a Word document using Microsoft Word that shows the expected output and attach it here for our reference. I will
    investigate as to how you are expecting your final document be generated
    like.

As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

Hi Tahir,



Thanks a lot…Its working fine with the code which you give last time…I removed some code part and it started working fine…But One issue arised… One extra blank page started coming in between…Can you tell me , why it happens ?

Sangeetha

Hi Tahir,


I resolved it. Its coming because, If the entire content(child rows) comes inside a single parent row node, and if the content is too large to display inside one page, its leaves a blank page and try to fit all content inside one page by hiding the end data…So i remove the parent row node…
Earlier it was:
//its title
//its desc
//its title
//its desc
//its title
//its desc
//its title
//its desc

Now:
//its title
//its desc
//its title
//its desc
//its title
//its desc


Thanks a lot
Sangeetha

Hi Sangeetha,

Thanks for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.