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

166
Views
La generación de documentos de Word falló al exportar html a .doc/.docx usando javascript
 let style= "<style> @page {size:29.7cm 21cm; mso-page-orientation:landscape; margin: 1.2cm 1.2cm 1.2cm 1.2cm; } @page Section1 { } div.Section1 {page:Section1 ;} </style>"; var header = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns='http://www.w3.org/TR/REC-html40'><head>"+ "<meta charset='UTF-8'>"+ style+"</head><body>"; var footer = "</body></html>"; let memo_html = await this.GetMemo_html() ; var blob = new Blob(["\ufeff", html], { type: "application/msword", }); // Specify link url var url = "data:application/vnd.ms-word;charset=utf-8," + encodeURIComponent(html); // Specify file name let filename = "NewspaperAddMemo.docx"; // Make download link element var filefulldlink = document.createElement("a"); document.body.appendChild(filefulldlink); if (navigator.msSaveOrOpenBlob) { navigator.msSaveOrOpenBlob(blob, filename); } else { // Make a link to the file filefulldlink.href = url; // Setting the file name filefulldlink.download = filename; //triggering the function filefulldlink.click(); } document.body.removeChild(filefulldlink);

a veces, cuando exporto el código html a un documento de Word, se genera este tipo de documento fallido. ingrese la descripción de la imagen aquí Pero a veces se exporta el archivo correcto. ingrese la descripción de la imagen aquí Pero estos dos son códigos html diferentes. Pero, cuando genero un archivo pdf desde el código html, siempre funciona bien. entonces, no hay nada malo con el código html. Incluso intenté copiar el código html en el editor de w3schools y no hubo ningún problema con el código html.

about 4 years ago · Juan Pablo Isaza
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!