Copy and Paste Table into Word

40 visualizzazioni (ultimi 30 giorni)
Mariam NAJI
Mariam NAJI il 23 Apr 2020
Risposto: BhaTTa il 17 Lug 2024
Hello,
I'm trying to copy and paste into MS Word a table from my code and i couldn't find a way to do it so. I'd like to paste and show in the same way Matlab shows the results on MS word.
I need ur help
Below the code i've been working.
% % % Display names
load_system(gcs);
Blockpaths= find_system(gcs,'Type','Block');
NOM =[];
for i = 1:length(Blockpaths)
b =strsplit(char(Blockpaths(i)),'/');
NOM =[NOM;b(end)];
end
% % % Display Types
open_system(gcs);
blks = find_system(gcs,'Type','block');
TYPE = get_param(blks, 'BlockType');
j = 1;
k = 1;
for i = 1:length(TYPE)
if ( strcmp(TYPE{i},'Inport'))
In{j} = blks{i};
In{j} = strrep(In{j},gcs,'');
j = j + 1;
elseif ( strcmp(TYPE{i}, 'Outport'))
Out{k} = blks{i};
Out{k} = strrep(Out{k},gcs,'');
k = k + 1;
end
end
% % % Create table
CONTENU=cell(length(Blockpaths),1);
t=table(NOM,TYPE,CONTENU);
SRCBLOCK=cell(length(Blockpaths),1);
t=table(NOM,TYPE,CONTENU,SRCBLOCK)
word = actxserver('Word.Application');
word.Visible = true;
wdoc = word.Documents.Add;
Selection = word.Selection;
table = Selection.Tables.Add(Selection.Range,size(t,1),4);
table.Columns.Borders.Enable = 1;

Risposte (1)

BhaTTa
BhaTTa il 17 Lug 2024

Categorie

Scopri di più su Tables in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by