Report generator to Word Table how to use AlowBreakAcrossPages
11 ビュー (過去 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!