Table in exported word document using html-docx-js is not formatted

595
May 04, 2017, at 4:59 PM

I'm using html-docx-js to convert a document from html to a word document. The issues seen in the resultant document are as listed below:

  • The exported file has the content of the html file. However, the content within tables does not retain it's formatting(The content displayed isn't in sync with the column titles).

  • The string 'Column Settings' is prepended to each column title.

  • The title of the 1st column is prepended to the title of every subsequent column of the table.

The js code used is:

var contentDocument = document.getElementById(ids[i]);
var content = '' + contentDocument.outerHTML;
var converted = htmlDocx.asBlob(content, {orientation: 'landscape', margins: {top: 720}});
saveAs(converted, ids[i]+'.docx');
var link = document.createElement('a');
link.href = URL.createObjectURL(converted);
link.download = ids[i];
link.appendChild(
    document.createTextNode('Click here if your download has not started automatically'));
var downloadArea = document.getElementById('download-area');
downloadArea.innerHTML = '';
downloadArea.appendChild(link);

Can anyone help with any pointers towards resolving this issue?

READ ALSO
Javascript: Spliting an array into sections

Javascript: Spliting an array into sections

I have an array that can be of any lengthand need to split it into sections

307
Download file headlessly served by javascript

Download file headlessly served by javascript

I need to automate file downloading from this page: http://wwwcboe

324
Enlage a small IMG to fit parent size without deforming Aspect ratio

Enlage a small IMG to fit parent size without deforming Aspect ratio

My website contains after clicking a topic, one img that chances on another img clickthe image sources themselves are not that large and can't fit a 1080 x 1920 display

304
Display flex. How to have second element displayed below first one.

Display flex. How to have second element displayed below first one.

I have one obstacle to solveI would like to have the element below the element

208