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?
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
-> I have replaced this code
var blob = new Blob([fileContent],
{
type: "application/msword;charset=utf-8"
});
saveAs(blob, fileName + ".doc");
-> as this one
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.
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.
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
It works for me:
And I can open both the files. Try once with 'Open With' option.
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)
It might be because of the default editor. Have you tried 'Open with Microsoft word'?
i dont have ms office in my laptop. in the offcie 365, word document i am uploading the file and trying to open it.
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.
But .doc file is opening perfectly without any issue, only .docx file is not opening
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.
Hello,
Can you please try this oml?
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.