I encountered an issue where DOCX files generated using the html-to-docx library fail to open in Microsoft Word. The error message displayed by Word is:
Word encountered an error trying to open the file.
After investigating the problem, I discovered that the issue is related to the margins object in the documentOptions configuration. When I remove the margins object, the DOCX file is generated correctly and opens without any issues in Word.
Hello,
I encountered an issue where DOCX files generated using the
html-to-docx
library fail to open in Microsoft Word. The error message displayed by Word is:After investigating the problem, I discovered that the issue is related to the
margins
object in thedocumentOptions
configuration. When I remove themargins
object, the DOCX file is generated correctly and opens without any issues in Word.Steps to Reproduce:
Use the following code to generate a DOCX file:
Observed Behavior:
Expected Behavior:
Workaround:
margins
object from thedocumentOptions
allows the DOCX file to open correctly in Word.Example of Working Code (without margins):
Environment:
@turbodocx/html-to-docx
1.9.3