MATLAB MATLAB REPORT GENERATOR - RELEASE NOTES Guia do Utilizador Página 866

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 986
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 865
13 Create a Report Program
13-14
Add Content as a Group
You can use a group to include the same content in different parts of a report. The DOM
API clones the members of a group before appending them to another object.
This example shows the key code to include. After describing the steps involved in using
a group, this example includes code for a complete report that uses a group.
1
Define the DOM objects that you want to include repeatedly in a report.
disclaimerHead = Heading(2,'Results May Vary');
disclaimerIntro = Paragraph('The following results assume:');
disclaimerList = UnorderedList(...
{'Temperature between 30 and 70 degrees F',...
'Wind less than 20 MPH','Dry road conditions'});
2
Define a Group object that includes the DOM objects for the group. For example:
disclaimer = Group();
append(disclaimer,disclaimerHead);
append(disclaimer,disclaimerIntro);
append(disclaimer,disclaimerList);
3
Append the Group object in the place in the report where you want to repeat the
content. For example, if the document object is doc:
append(doc,disclaimer);
This code builds on the code shown above.
import mlreportgen.dom.*;
doc = Document('groupReport','html');
disclaimerHead = Heading(2,'Results May Vary');
disclaimerIntro = Paragraph('The following results assume:');
disclaimerList = UnorderedList(...
{'Temperature between 30 and 70 degrees F',...
'Wind less than 20 MPH','Dry road conditions'});
disclaimer = Group();
append(disclaimer,disclaimerHead);
append(disclaimer,disclaimerIntro);
append(disclaimer,disclaimerList);
append(doc,disclaimer);
p1 = Paragraph('First set of results...');
p1.Bold = true;
p2 = Paragraph('more report content...');
Vista de página 865
1 2 ... 861 862 863 864 865 866 867 868 869 870 871 ... 985 986

Comentários a estes Manuais

Sem comentários