The ‘mlreportgen.dom’ API does not directly support opening and modifying an existing ‘.dotx’ file. This API is designed primarily for creating new documents, either from scratch or based on a template, and then adding content programmatically.  
To modify an existing ‘.dotx’ file, you can follow one of the approaches listed below: 
1.You can create a new document based on a template and then modify the new document. Refer to the following documentation link for more details: 
2. If you are using MATLAB on Windows, you can use ‘ActiveX’ to interact with Microsoft Word and open an existing ‘.dotx’ file named ‘MyTemplate.dotx’. Here is a code snippet demonstrating this workflow: 
Define the path to your .dotx file 
dotxPath = fullfile('path_to_dotx_file', 'MyTemplate.dotx'); 
wordApp = actxserver('Word.Application'); 
document = wordApp.Documents.Open(dotxPath); 
 You can refer to the documentation link for ‘actxserver’ for more details: 
 
Hope it helps! 
Best, 
Zinea