Report generator to Word Table how to use AlowBreakAcrossPages

8 views (last 30 days)
good morning
I used report gnerator to export matlab data to word, in tables.
Sometimes le line of my table flow on 2 pages. I dont wnat that , i want word to go to tonexte page if the new line ios too high for the remaining space on the page.
I think i have to use AlowBreakAcrossPages(tf) with tf= false.
but i do not understand how to use this component or property or method or object
must i put it in a style ?
should it be associated to the entire table ofr to each line
I need an exanple to understand.
thank you

Answers (3)

Rahul Singhal
Rahul Singhal on 29 Aug 2023
Hi Daniel,
You can refer to the example in the MATLAB command-line help for this class:
>> help mlreportgen.dom.AllowBreakAcrossPages
-Rahul

Divyanshu
Divyanshu on 29 Aug 2023
Hi Daniel,
I understand that you are trying to disable the page-breaks so that if there is a long row which cannot fit on the current page then it should be moved to the next page completely.
Here is a possible workaround which you can refer to, for achieving the same:
word = actxserver('Word.Application');
doc = word.Documents.Open('Absolute Path to your generated doc file');
numSections = doc.Sections.Count;
% Loop through each section and disable page breaks
for i = 1:numSections
section = doc.Sections.Item(i);
% Insert continuous section break
section.Range.InsertBreak(3); % 3 represents wdSectionBreakContinuous
end
doc.Save;
doc.Close;
word.Quit;
Refer the following documentations for better understanding:

Namnendra
Namnendra on 5 Sep 2023
Hey Daniel,
I understand that you want to move a table row to new page if the row doesn't fit in the page. For that you want to use the "mlreportgen.dom.AllowBreakAcrossPages" class object.
To achieve this, you need to add this property to the "Style" property of the table.
Example code:-
table = mlreportgen.dom.Table();
tableStyles = {mlreportgen.dom.AllowBreakAcrossPages('false')};
table.Style = [table.Style tableStyles];
This will force a row to start on the next page when it cannot fit on the current page.
To know more, kindly refer to following documentation:-
I hope the above information helps you.
Thank you.
Namnendra Gupta
  1 Comment
Daniel MONTERRAIN
Daniel MONTERRAIN on 6 Sep 2023
HI,
on my computer wirth matlab R2019 your seems not to operate
with tableStyles = {mlreportgen.dom.AllowBreakAcrossPages('false')}; there is an error
Error using mlreportgen.dom.AllowBreakAcrossPages
No constructor 'mlreportgen.dom.AllowBreakAcrossPages' with matching signature found.
with tableStyles = {mlreportgen.dom.AllowBreakAcrossPages(false)}, there is no error but no impact on the result
until now no solution

Sign in to comment.

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!