Problems to save a .docx file

7 views (last 30 days)
Jorge Pascual
Jorge Pascual on 17 Jun 2020
Answered: Utsav Agrawal on 18 Jun 2020
Hi everyone!
I'm trying to develop a program in App Designer, where I introduce some data about a subject, such as: Name, ID number, Nationality, etc... And then I introduce these data in some specifc points of a fix text, something quite similar to: The student <<Name>> with ID number <<ID Number>>.
I have achieved to put all this text in a 'word' file, but I'm having some problems when I try to save it. If I achive to save it, then I can't open it because the document has problems, other things that I have tried don't allow me to save it, so I don't know what I have to do.
Nombre = app.NombrealumnoEditField.Value;
expression=' ';
replace='_';
Nombre1=regexprep(Nombre,expression,replace);
Nombre_Fich=strcat('CONTRATO_',Nombre1,'.docx')
word = actxserver('Word.Application');
word.Visible =1; %make Word Visible
document=word.Documents.Add; %create new Document
.
.
.
Name_File=strcat('CONTRATO_',Nombre1,'.docx')
[Name,Path] = uiputfile(Nombre_Fich,'Save file name')
Name_Path = fullfile(Path,Name)
save(Name_Path);
I have also tried (Following a similar question) to use document() and open, but I get the next error:
Error using mlreportgen.dom.Document/open
Unable to check out a Report Generator license. Reason: License checkout failed.
License Manager Error -5
Cannot find a license for MATLAB_Report_Gen.
Troubleshoot this issue by visiting:
https://www.mathworks.com/support/lme/R2019b/5
Diagnostic Information:
Feature: MATLAB_Report_Gen
License path: C:\Users\USUARIO\AppData\Roaming\MathWorks\MATLAB\R2019b_licenses\license_DESKTOP-1JHTRA4_40589230_R2019b.lic;C:\Program Files\MATLAB\R2019b\licenses\license.dat;C:\Program Files\MATLAB\R2019b\licenses
Licensing error: -5,357.
Nombre = app.NombrealumnoEditField.Value;
expression=' ';
replace='_';
Nombre1=regexprep(Nombre,expression,replace);
Nombre_Fich=strcat('CONTRATO_',Nombre1,'.docx')
[Name,Path] = uiputfile(Nombre_Fich,'Save file name');
Name_Path = fullfile(Path,Name);
Contract = Document(Name_Path,'docx');
open(Contrato);
Thank you in advance!

Answers (1)

Utsav Agrawal
Utsav Agrawal on 18 Jun 2020
My understanding of your question is that you are unable to save a .docx file that you created using MATLAB due to licensing issues.
This error is likely because you don’t own the license for the product you are trying to use, in this case, MATLAB report generator.
For more details, you can refer this.

Categories

Find more on Entering Commands in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!