Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

377
Views
Render docx in React js

I would like to properly render a docx file in React JS with the correct formatting, as it would appear in Word or a similar service. Currently, when displaying the text, all formatting is removed and appears as plain text. I obtain the file from the server, and process it, by:

const url = "http://localhost:8080/files/aboutme.docx";

axios.get(url, {
  responseType: 'arraybuffer',
}).then(response => {
  var doc = new Docxtemplater(new PizZip(response.data), {
    delimiters: {
      start: 'ran',
      end: 'ran'
    }
  });
  var text = doc.getFullText();
  setAboutMe(text);
})

I am using the Docxtemplater and PizZip libraries.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Docxtemplater is

a library to generate docx/pptx documents from a docx/pptx template

If you need to render a docx file I think you should use react-doc-viewer. Then you could write something like:

import DocViewer from "react-doc-viewer";

function App() {
  const doc = [{ uri: "http://localhost:8080/files/aboutme.docx" }];

  return <DocViewer documents={doc} />;
} 
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!