Report Generator - Prevent Table from Breaking onto Multiple Pages

5 ビュー (過去 30 日間)
Madeline Oglesby
Madeline Oglesby 2015 年 3 月 17 日
コメント済み: Sean de Wolski 2015 年 3 月 20 日
Is there a way to automatically detect with the report generator when a table will not fit on page and insert a page break so that the table can start on the next page?

採用された回答

Sean de Wolski
Sean de Wolski 2015 年 3 月 17 日
Since this only applies to docx reports, this can be done by defining a table style and then applying it when necessary.
Attached in the *.zip file is a word document with this custom table style.
  6 件のコメント
Madeline Oglesby
Madeline Oglesby 2015 年 3 月 19 日
I suspect that it may have something to do with the fact that the top left cell in my tables are 'empty'. I've recreated something similar below:
import mlreportgen.dom.*;
d = Document('Test','docx');
table_sample = {[],'Sample Table';
'1','10%';
'2','20%';
'3','15%';
'4','15%';
'5','30%';
'6','5%';
'7','5%'};
for lx = 1:10
text_sample = Text('Sample Title');
append(d,text_sample);
tableObj = Table(table_sample);
tableObj.RowSep = 'solid';
tableObj.ColSep = 'solid';
tableObj.Border = 'double';
tableObj.TableEntriesStyle = { KeepWithNext, KeepLinesTogether };
append(d,tableObj);
end
close(d);
rptview(d.OutputPath);
Sean de Wolski
Sean de Wolski 2015 年 3 月 20 日
The reason it's splitting isn't so much because it's empty as it is because [] creates an empty double array and the input should be a string.
Use '' instead.
table_sample = {'','Sample Table';
'1','10%';
'2','20%';
'3','15%';
'4','15%';
'5','30%';
'6','5%';
'7','5%'};

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by