Report generator to Word Table how to use AlowBreakAcrossPages
조회 수: 13 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (3개)
Rahul Singhal
2023년 8월 29일
Hi Daniel,
You can refer to the example in the MATLAB command-line help for this class:
>> help mlreportgen.dom.AllowBreakAcrossPages
-Rahul
댓글 수: 0
Divyanshu
2023년 8월 29일
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:
댓글 수: 0
Namnendra
2023년 9월 5일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!