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

  • 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 880
Fill the Blanks in a Report Form
13-29
Fill the Blanks in a Report Form
Navigate Holes in the Form
When you create a form template, you associate an ID with each hole in the template.
This allows you to navigate the holes in a form, using the DOM moveToNextHole
function. The first time you execute this function, the DOM API copies to the output
document all of the text up to the first hole in the template. At this point, you can start
adding content to the output document, using this DOM append function, thereby filling
in the first hole. The next time you execute this function, the DOM API copies all the text
between the first and second hole in the template to the output document. You can then
fill in the second hole by appending content to the output document. In this way, you
generate the output document by copying the content from the template and filling in all
its holes.
For example, this function generates a report from a Word template that has three holes
named Title, Author, and Content. The arguments title, author, and content, are
assumed to be strings.
function makerpt(title,author,content,rptname,rpttemplate)
import mlreportgen.dom.*
rpt = Document(rptname,'docx',rpttemplate);
while ~strcmp(rpt.CurrentHoleId,'#end#')
switch rpt.CurrentHoleId
case 'Title'
append(rpt,title);
case 'Author'
append(rpt,author);
case 'Content'
append(rpt,content);
end
moveToNextHole(rpt);
end
close(rpt);
See Also
Functions
mlreportgen.dom.Document.moveToNextHole
Vue de la page 880
1 2 ... 876 877 878 879 880 881 882 883 884 885 886 ... 985 986

Commentaires sur ces manuels

Pas de commentaire