问题
(Hello, this is a similar question to I've made but that was working with an embedded word doc within another word doc. Hopefully this is an easier alternative as it is directly accessing a table within a word doc)
I am currently trying to access information on an existing Word document through MATLAB. I've found ActiveX capability through MATLAB to access a Word document, but I'm not well versed in MATLAB or VBA.
Specifically, this project hopes to take in a Word document, look through its contents, extract information from a table, and then be able to modify, parse, compare, etc. the data within MATLAB.
I've found resources that show how to initiate activex through MATLAB and open a Word Document but, I'm not sure how to go about finding the tables within the Word doc and then extract the table information to store in MATLAB.
Any help or advice would much appreciated!
I've used the following links for my initial attempts
Connecting to Word through ActiveX, opening the document, and then finding a keyword: https://www.mathworks.com/matlabcentral/answers/344080-how-to-use-activex-to-search-word-documents-for-a-phrase-and-delete-the-document
Word VBA Reference Points: https://docs.microsoft.com/en-us/office/vba/api/overview/Word/object-model
Exploring COM Objects through ActiveX: https://www.mathworks.com/help/matlab/matlab_external/exploring-your-object.html#f90970
% Connect to Word
Word = actxserver('Word.application');
Word.Visible = 0;
% Open Doc
WDoc = Word.Document.Open('filename');
% Find the Keyword
select = Word.Selection;
...
来源:https://stackoverflow.com/questions/56111943/finding-tables-from-existing-ms-word-file-using-matlab-activex