InsertHtml with paragraph justify

Hi!

I’ve tried this code to generate Word document with justified paragraph from HTML but it seems doesn’t work. The text is always to the left. I’m using the newest version of Aspose.Word 13.9.

// Create document and DocumentBuidler object
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
 
// Insert HTML.
string html = "<P align=\"justify\">Müdürlüğünüzde X XXXX XX XX XXXXXXX XXX XX XX sicil sayılı dosyada işlem gören ve XXXXX Xxx. Taah. San. ve Tic. Ltd. Şti firmasına ihale ederek teslim almış olduğumuz Xxxxx Xxxxx Xxxxx Xxxxxx yapım işine dair İlgi (X) yazınız ile istenen bilgiler takip eden sayfada yer almaktadır. </P>";
builder.InsertHtml(html);
 
doc.Save(@"c:\out.doc");

Hi,

Thanks for your inquiry. Please do the following change in your HTML mark-up to be able to apply “Justify” alignment to the paragraph in Word document:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert HTML.
string html = "<P style=\"text-align:justify\">Müdürlüğünüzde X XXXX XX XX XXXXXXX XXX XX XX sicil sayılı dosyada işlem gören ve XXXXX Xxx. Taah. San. ve Tic. Ltd. Şti firmasına ihale ederek teslim almış olduğumuz Xxxxx Xxxxx Xxxxx Xxxxxx yapım işine dair İlgi (X) yazınız ile istenen bilgiler takip eden sayfada yer almaktadır. </p>"; 
builder.InsertHtml(html);
doc.Save(@"c:\out.doc");

Best regards,

I know this trick but my html editor use
. We have also many documents generated in HTML with this tag so it’s not easy to use text-align:justify tag.
It’s not possible to use this markup with Aspose ? For example
works perfectly

Hi,

Thanks for your inquiry. Aspose.Words imports/exports paragraph alignment from/to “text-align” paragraph style attribute and mimics the behaviour of Microsoft Word. To you, this means that if you convert your input HTML file into Word document using Aspose.Words, the output will appear exactly as if it was done by Microsoft Word. Microsoft Word 2013 behaves in a similar manner. Moreover, please note that the
align attribute is not supported in HTML5 any more. I would suggest you please use CSS instead. If we can help you with anything else, please feel free to ask.

Best regards,