Add space and style to sliced table - MATLAB Report Generator
    4 views (last 30 days)
  
       Show older comments
    
I am trying to add some space between the sliced table but I get the error below. In addition, how can I change the table header style?
Error: 
Error using mlreportgen.dom.Document/append
Cannot append child that has a parent.
Code:
function ReportButtonPushed(app, event)
            import mlreportgen.dom.*;
            import mlreportgen.report.*
            import mlreportgen.utils.* 
            mTable  = MATLABTable(app.dataReport);
            p = Paragraph();
            p.Style = {LineSpacing(1.5)};
            slicer = TableSlicer("Table",mTable,"MaxCols",5,"RepeatCols",1);
            totcols = slicer.MaxCols - slicer.RepeatCols;
            slices = slicer.slice(); 
            d = Document('slice','pdf');
            d.OutputPath = ['E:/','Sliced'];
            for slice=slices
                 append(d,MATLABTable([app.dataReport(:,1) app.dataReport(:,slice.StartCol:slice.EndCol)]));
                 append(d, p);
            end
            close(d);
            rptview(d.OutputPath);  
        end
0 Comments
Answers (1)
  Sean de Wolski
      
      
 on 11 May 2020
        You're appending the same paragraph multiple times.  It can only be appended once.  Clone it first
append(d,clone(p))
1 Comment
See Also
Categories
				Find more on MATLAB Report Generator Task Examples in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
