Report generator to Word Table how to use AlowBreakAcrossPages
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (3)
Rahul Singhal
am 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
0 Kommentare
Divyanshu
am 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:
0 Kommentare
Namnendra
am 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
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!