Finding Tables from existing MS-Word File using MATLAB (ActiveX)

有些话、适合烂在心里 提交于 2019-12-20 04:26:38

问题


(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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!