How to save a .docx Word document on a specific path?
Show older comments
I have created a GUI where the last step is to create a Word report with the results, using "import mlreportgen.dom.*;"
I ask the user to specify the path where he wants to save the Word via "uiputfile".
Therefore, I have obtained the full name (path + name) of the Word report.
Then I use the function "save" with the full name of the report (name + path).
After that I would like to automatically open that Word report.
However, using the function "save", the Word that is saved in that specific path is corrupted, so it does not open correctly.
I have seen on the Help documentation that "save" does not apply for ".docx" files. So, is there any other way to save the Word report on that specific path set by the user via uiputfile?
Below I attach part of the code I am using, in case it helps:
%%%MATLAB CODE %%%
Report_full_name = strcat(Report_name,'.docx'); %From 'Report' to 'Report.docx'
[Saved_Name,Saved_path] = uiputfile(Report_full_name,'Save file name'); %Obtain path: C\Folder (etc)
Saved_Name_and_Path = strcat(Saved_path,Saved_Name); %Create full name: C\Folder\Report.docx
save(Saved_Name_and_Path); %Save the file C\Folder\Report.docx
open(Saved_Name_and_Path); %Open the file C\Folder\Report.docx
%%%END %%%
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Report Generator in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!