MATLAB MATLAB REPORT GENERATOR - RELEASE NOTES Guide de l'utilisateur Page 902

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 986
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 901
13 Create a Report Program
13-50
}
For more information about using HTML styles with DOM objects, see “Modify Styles in
an HTML Template” on page 13-127.
Apply a Style to a Paragraph Object
Apply a template style to a Paragraph object either as the second argument in a
Paragraph object constructor or by setting the StyleName property to a template
style. For example, suppose you have defined styles named BodyPara and TableTitle
in the template for your report. This example specifies a style name in a Paragraph
constructor and in a Paragraph object StyleName format property, using the
TableTitle style defined in MyTemplate.
import mlreportgen.dom.*;
rank = 5;
rpt = Document('MyReport','html','MyTemplate');
p = Paragraph('Here is a magic square or rank 5:','BodyPara');
append(rpt,p);
p = Paragraph(sprintf('Rank %d MagicSquare',rank));
p.StyleName = 'TableTitle';
append(rpt,magic(rank));
close(rpt);
rptview(rpt.OutputPath);
Override Template Formats
You can use programmatic formats to override the paragraph formats defined in a
template-based paragraph style. For example, suppose you define a paragraph style
named BodyPara in your Word template and set the KeepWithNext property to off. You
can override the style in your report program to keep a particular paragraph on the same
page with the next paragraph. For example:
import mlreportgen.dom.*;
rpt = Document('MyReport','docx','MyTemplate');
p = Paragraph('Keep this body paragraph with next.','BodyPara');
p.Style = {'KeepWithNext'};
append(rpt,p);
p = Paragraph('Next paragraph.');
Vue de la page 901
1 2 ... 897 898 899 900 901 902 903 904 905 906 907 ... 985 986

Commentaires sur ces manuels

Pas de commentaire