101
Views
13
Comments
[HTML To MS Word Converter] doc to docx conversion
html-to-ms-word-doc-convertor
Reactive icon
Forge asset by Benjith Sam
Application Type
Reactive

I have used this forge component to convert html to docx. But i am getting only .doc extension file. I need .docx extension file. Can somebody help me get through this one?

2022-12-09 04-50-17
Shubham Doshi

Hello Nihaal,

1. Open the forge asset

2. Open the script from the forge asset

3. Change the extension from .doc to .docx as shown below:

4. Then manage dependencies

It should work then

I hope it helps :) Let me know if it worked

2022-07-21 04-14-52
Nihaal

-> I have replaced this code 

var blob = new Blob([fileContent], 

{                

type: "application/msword;charset=utf-8"            

});            

saveAs(blob, fileName + ".doc");

-> as this one

var blob = new Blob([fileContent], 

{                

type: "

application/vnd.openxmlformats-officedocument.wordprocessingml.document

;charset=utf-8"           

});            

saveAs(blob, fileName + ".docx");


-> But this change doesn't worked. I can download docx file but it is not opening.

2022-08-03 04-32-50
Ravi Punjwani

Hi Nihaal,

It won't open the DOCX renamed file because the underlying format of the file, is not changed by only changing the filename.

I suggest using another forge component if this doesn't solve your purpose of having a proper DOCX file.

To learn more, try to open your generated DOC file in a text editor (Notepad++ or even Notepad). You will notice that it has not converted your file actually in the DOC format, only wrapped the HTML file in word format so it can be opened in the MS word app.

2022-07-21 04-14-52
Nihaal

i tried with 3 other components but of no use only .doc files are downloading. can u help me in suggesting best forge one which downloads as .docx 

2022-12-09 04-50-17
Shubham Doshi

It works for me:

And I can open both the files. Try once with 'Open With' option.

2022-07-21 04-14-52
Nihaal

i changed to .docx in the editor and new file is downloading in .docx extension. but file is not opening (error: sorry this document can't be opened for editing)

2022-12-09 04-50-17
Shubham Doshi

It might be because of the default editor. Have you tried 'Open with Microsoft word'?

2022-07-21 04-14-52
Nihaal

i dont have ms office in my laptop. in the offcie 365, word document i am uploading the file and trying to open it.

2022-12-09 04-50-17
Shubham Doshi

Then how are you suppose to open the word if you don't have MS word installed. Try installing WPS office, its free to use : https://www.wps.com/ if you don't have access to MS Word.


2022-07-21 04-14-52
Nihaal

But .doc file is opening perfectly without any issue, only .docx file is not opening

2022-12-09 04-50-17
Shubham Doshi

Yes, I understand. Office 365 is considering your file as corrupt somehow. But if you open it in the offline application, it won't face any issue.

2018-08-27 08-29-35
Fábio Vaz

Hello,

Can you please try this oml?

HTML2DOCXJS.oml
2022-07-21 04-14-52
Nihaal

Hi Fabio,

How to apply styles for the document. I tried the oml but styles and the view is changing after converting. Can u help me in applying styles for the document.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.