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

Free Support Forum - aspose.com

Converting two column paragraph from HTML to word

Hello,

I have a probleme. I use Aspose to convert html to word.
I would like to display two divs, one next to the other (and not one under the other)

In a browser I would use the html shown below.

<div>
<div style=“float: left;”>xxx</div>
<div style=“padding-left: 30px;”>random text on several lines. Entreprises seront donc contractuellement réputées tenir compte de toutes les constatations faites lors de cette reconnaissance, et comprendre explicitement ou implicitement tous les travaux accessoires et autres prestations nécessaires.
Text after a BR that doesn’t go undex the xxx div</div>
</div>

My problem is that when it’s translated in word, the div are one under the other. If I change the second div with “display : inline” the divs are one next to the other but, when the text goes to the next line, it goes under the XXX, and not next to it
I want this result :
xxx random text on several lines
      blabla blabla blabla blabla
      Text after a BR

I don’t want this result:
xxx random text on several lines
blabla blabla blabla blabla
Text after a BR

Could you please tell me what css rules I should apply to my div to make it work ?
Mabe I should use some kind of table (<table><tbody><tr><td style=“vertical-align: top;”>xxx</td><td> random text on several lines<br>blabla blabla blabla blabla<br>Text after a BR</td></tr></tbody></table>)

The best, for me, would be to make a “paragraph suspended retreat” or a “paragraph withdrawal” : When I click the paraph option in word, I can make a “suspended withdrawal” which does exactly what I want. How can I tell aspose to create such a paragraph style?

Thanks for your help.

@rodrigue.leopold,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you convert your HTML to DOCX using MS Word, you will get the same output.

Please ZIP and attach your expected output Word document here for our reference. We will then provide you more information on this.

Hello,
Sorry for my late reply, but I never got the watching notification. (Do you send an email, when someone replies?) And I forgot the problem, until a client asked us about the problem.
I attached a word with the paragraph and the withdraw. (Sorry, my Word is in french, and I have to translate the label, in french, the label is “first line” => “suspended” => “0.9cm”
Thanks 4 your help :smiley:
paragraphWithWithdraw.zip (9.3 KB)

@rodrigue.leopold

Thanks for your inquiry. In your document, you have set the hanging indent of paragraph. You can use ParagraphFormat.FirstLineIndent property to get or set the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent.

The email is sent to your email id that is attached with your user name.

Thanks for your help, but I inject html into word, and I’m creating the file paragraph by paragrah. That’s why I need to do it with css… Is there a way to do it with css (even if it’s a special aspose css rule, like the “-aw-headerfooter-type”) I could eventualy use a special style, if it can’t be solved by css.

@rodrigue.leopold

Thanks for your inquiry. You can use the style (“margin-left:25.5pt;text-indent:-25.5pt;”) in your HTML. You may insert the HTML into document, iterate over inserted paragraphs and set the value of ParagraphFormat.FirstLineIndent property.

Thanks, it tried it on production, it worked… My clients are happy :smiley: