A list,

Generate Word+PPT report based on MATLAB

Ii. Source code

% demo2.m
import mlreportgen.dom.*;
d=Document('demo2'.'docx'); open(d); %% page set s = d.c. urrentDOCXSection; s.PageSize.Orientation ='landscape'; % portrait(default)
s.PageSize.Height = '8.5 in';
s.PageSize.Width = '11in';
s.PageMargins.Left = '3.0 cm';
s.PageMargins.Right = '3.0 cm';
s.PageMargins.Top = '2.5 cm';
s.PageMargins.Bottom = '2.5 cm'; % Heiti =FontFamily; heiti.FamilyName='Arial';
heiti.EastAsiaFamilyName='bold';
songti=FontFamily;
songti.FamilyName='Arial';
songti.EastAsiaFamilyName='宋体'; % % title p = Heading (1.'Matlab Automation Report Template '); % level 1 heading % p.collor ='red';
%p.HAlign='center';
p.Style={heiti,Color('red'),HAlign('center')}; append(d,p); % % paragraph append (d, Heading (2.1. Paragraph Template));
s='Here's the paragraph. ';
s=repmat(s,[1.12]); p = Paragraph(s); P.style ={songti,Color('blue'),...
    LineSpacing(1.5),...
    OuterMargin('10pt'.'0pt'.'0pt'.'10pt')};
p1=Text('underlined. '); P1.underline ='single';
p1.Color='red';
append(p,p1);
append(p,s);
p2=ExternalLink('http://github.com/gasongjian/'.'Hyperlink');
append(p,p2);
p.FontSize='14pt';
p.FirstLineIndent='28pt'; % here is something like that2Append (d,p); %% simple form append(d,Heading(2.'2. Simple Table'));
t={'chi Ming'.'Chinese'.'mathematics'.'English'; .'results'.'70'.'98'.'89'; .'class'.'B'.'A'.'A'}; p=Table(t); Format a paragraph in a cellfor ii=1:p.NRows
    for jj=1:p.NCols
        t=entry(p,ii,jj);
         t.Children(1).Style={songti,...
            Color('green'),...
            FontSize('12pt'),...
            LineSpacing(1.0),...
            OuterMargin('0pt'.'0pt'.'0pt'.'0pt')};
    end
end

p.Style = {Border('single'.'blue'.'3px'),... ColSep('single'.'blue'.'1px'),... RowSep('single'.'blue'.'1px')};

p.Width = '50%';
p.HAlign='center'; % center aligned p.tableentrieshalign ='center';
p.TableEntriesVAlign='middle'; append(d,p); %% complex table append(d,Heading(2.'3. Complex Forms'));
q = Table(5);
q.Border = 'single';
q.ColSep = 'single';
q.RowSep = 'single';

row = TableRow;
te = TableEntry('Algorithm name');
te.RowSpan = 2;
append(row, te);

te = TableEntry('Category one');
te.ColSpan = 2;
%te.Border = 'single';
append(row, te);
te = TableEntry('Second class');
te.ColSpan = 2;
%te.Border = 'single'; append(row, te); append(q,row); % row=TableRow; append(row,TableEntry('T1'));
append(row,TableEntry('T2'));
append(row,TableEntry('T3'));
append(row,TableEntry('T4')); append(q,row); % t=TableRow; append(t,TableEntry('items'));
for i=1:4
    append(t,TableEntry(")); end append(q,t); append(q,clone(t)); append(q,clone(t)); append(q,clone(t)); q.TableEntriesStyle={Width('80 '),Height('40')};
q.Style = {Border('single'.'green'.'3px'),... ColSep('single'.'green'.'1px'),... RowSep('single'.'green'.'1px')};

q.HAlign='center'; % center aligned q.tableentrieshalign ='center';
q.TableEntriesVAlign='middle'; %% insert image append(d,Heading(2.'4. Picture Template'));
p1 = Image('myPlot_img.png'); % ScaleToFit is used to make the image size fit on the page. It can also be changed to the custom size Settings below %p1.Style={HAlign('center'),ScaleToFit(1)};
p1.Style={HAlign('center'),Width('600px'),Height('400px')};
append(d,p1);

close(d);
rptview(d.OutputPath);
Copy the code

3. Operation results

The specific output prevails

Fourth, note

Version: 2014 a