NodeJs using html-to-docx: text is ltr instead of rtl

270 Views Asked by At

I'm using html-to-docx package to convert an html string to a word file. It's working good, only problem is my text is in Hebrew/Arabic meaning direction is rtl and supposed to be aligned to the right. All the p tags have in-line style of direction:rtl and text-align:right. Still, on the word file it is all ltr and aligned to the left.

this is my code:

const htmlToDocx = require('html-to-docx');
const convertPostToWord = async (content, callbackFunc) => {
    let today = new Date();
    filename = 'postwordfiles/'+today+'.docx';
    buffer = await htmlToDocx(content, {endcoding: 'utf8',documentOptions: {
        font: 'Arial'
      }});
    fs.writeFileSync(filename, buffer);
  
    return callbackFunc(filename); 
}
0

There are 0 best solutions below