MATLAB Report Generator Table Avoid Word Splitting

조회 수: 15 (최근 30일)
Emmanouil
Emmanouil 2019년 4월 19일
편집: Emmanouil 2019년 4월 23일
Hi,
I am using MATLAB R2018b and I am constructing a Table in Report Generator that has strings as entries. When a string has many words it is possible that it breaks into more than one line. However, the breaks often force a single word to split between the lines. I want the line break to avoid splitting any words, that is to be forced only to the spaces of the string.
For example, after running the following piece of code we can see that the words "Krankenversicherungskarte" and "Lebensabschnittpartner" are split between two lines (see attachement).
Is there a neat way to avoid this?
% import package
import mlreportgen.dom.*
% create the document object
doc_obj = Document('MATLAB_test_report','pdf');
% table
tableObj = Table ( {'Some big German words','The first is Krankenversicherungskarte','The second is Lebensabschnittspartner'} ) ;
% append
append ( doc_obj , tableObj ) ;
% close document
close(doc_obj);
% display
rptview(doc_obj);

채택된 답변

Paul Kinnucan
Paul Kinnucan 2019년 4월 23일
The Report Generator hyphenates table entries by default to fit symbolic and numeric data into an entry. You can use the Hyphenation format to disable this behavior for natural language content.
% import package
import mlreportgen.dom.*
% create the document object
doc_obj = Document('MATLAB_test_report','pdf');
% table
tableObj = Table ( {'Some big German words','The first is Krankenversicherungskarte','The second is Lebensabschnittspartner'} ) ;
tableObj.Style = {Hyphenation(false)};
% append
append ( doc_obj , tableObj ) ;
% close document
close(doc_obj);
% display
rptview(doc_obj);
  댓글 수: 1
Emmanouil
Emmanouil 2019년 4월 23일
편집: Emmanouil 2019년 4월 23일
Thanks Paul, works like a charm :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by