Microsoft Word Check Box
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
HI,
Could someone offer a solution to use Matlab to read a word template and Tick Check Boxes such the ones illustrated below. Thanks![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/220912/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/220912/image.png)
0 comentarios
Respuestas (1)
Madheswaran
el 26 de En. de 2025 a las 13:29
Hi Thomas,
MATLAB provides a powerful way to automate Microsoft Word operations through the ActiveX interface. Here's how you can programmatically manipulate Word documents and form fields:
wordApp = actxserver('Word.Application');
wordApp.Visible = 1;
doc = wordApp.Documents.Open(fullfile(pwd, 'template.dotx')); %Your word template file
controls = doc.ContentControls;
for i = 1:controls.Count
aaa = controls.Item(i).Type;
if strcmp(controls.Item(i).Type, 'wdContentControlCheckBox')
controls.Item(i).Checked = true;
end
end
doc.Save();
doc.Close();
wordApp.Quit();
The above code creates a Word application instance, opens your template file, iterates through form fields to find checkboxes, and sets their values. After modifications, it saves and closes the document before quitting Word.
For more infromation, refer to the following documentation: https://mathworks.com/help/matlab/ref/actxserver.html
Hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre MATLAB Report Generator en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!