react-file-viewer
react-file-viewer copied to clipboard
Some alignment Header issue
Hello, I've implemented your plugin in my react app. But the problem is all the contents coming on the left side even some header text is at the center in the document file. That header is also coming on the left side. I want to display exact docx contents as it is in the react app. How to do that?
I checked your below file
react-file-viewer/src/components/drivers/docx-viewer.jsx
In that, you are using one npm plugin,
import mammoth from 'mammoth';
I tried this plugin without using your plugin. But got some error.
Below is my react code.
import React, {useEffect, useState} from 'react';
import mammoth from 'mammoth';
const DocViewer = () => {
const [data, setData] = useState(null);
useEffect(()=> {
mammoth.convertToHtml({ path: 'https://file-examples.com/wp-content/uploads/2017/02/file-sample_100kB.docx' })
.then(function (result) {
setData(result.value);
console.log('message ', result.messages);
})
.done();
}, []);
return (
<>
{data}
</>
);
}
export default DocViewer;
My react version is
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1",
Can you please tell me why it is not working?
And also I'm getting warning message like
I also created a typescript file in below folder
node_modules/mammoth/mammoth.d.ts
Still, I'm getting a warning message.
Please tell me how to use mammoth plugin?