Closed xiejianxuan5 closed 7 years ago
Mammoth intentionally doesn't copy the exact formatting of the source document. Instead, you can map styles in Word onto CSS classes -- take a look at the documentation on style maps.
Thank you very much for the answer to me, I do not know how to find the style of the word document, how to put all the word document style with html one by one correspondence. Such as word document into html, the form of the border are gone. How do I set the side of the table? How does the custom style map correspond to the style of all word documents? thanks
I'm afraid I'm not sure I understand all your questions, but I'll do my best to answer them.
I do not know how to find the style of the word document
The style for a paragraph can be found by putting the caret into the relevant text, and then looking at the styles toolbar. This is the toolbar that normally shows styles such as "Heading 1".
How do I set the side of the table
Assuming you want all your tables to be styled similarly, the best way of doing this is to style the table in CSS.
How does the custom style map correspond to the style of all word documents?
You can map each Word style to a different CSS class. For instance, the built-in mapping for "Heading 1" is:
p[style-name='Heading 1'] => h1:fresh
why a line break is not identified by mammoth in docx file and not shown in a html file?
Hello Thank you very much for providing the functionality, but I am now having a problem. I converted the docx file to html when the conversion was successful. But the original word in the style are gone, lost. Converted html only p tags, strong tags. I hope you can help me, thanks