mlreportgen.dom.CounterInc 类
命名空间: mlreportgen.dom
数字流计数器增量器
创建对象
描述
创建一个空的计数器增量器。counterIncObj
= CounterInc
为每个指定的编号流创建一个计数器增量器。将此格式分配给 DOM 对象的样式会导致在将对象追加到文档时关联的流计数器递增。counterIncObj
= CounterInc(streamNames)
输入参量
streamNames
— 编号流名称
字符向量
编号流名称,指定为字符向量。要指定多个流名称,请在流名称之间添加空格。
属性
Id
— mlreportgen.dom.CounterInc
对象的标识符
字符向量 | 字符串标量
mlreportgen.dom.CounterInc
对象的对象标识符,指定为字符向量或字符串标量。DOM API 在创建文档元素对象时会生成一个会话唯一标识符。您可以为 Id
指定自己的值。
属性:
NonCopyable | true |
数据类型: char
| string
StreamNames
— 编号流名称
字符向量
编号流名称,指定为字符向量。要指定多个流名称,请在流名称之间添加空格。
Tag
— mlreportgen.dom.CounterInc
对象的标签
字符向量 | 字符串标量
mlreportgen.dom.CounterInc
对象的标签,指定为字符向量或字符串标量。DOM API 在创建此对象的过程中生成一个会话唯一标签。生成的标签形式为 CLASS:ID
,其中 CLASS
是对象类,ID
是对象的 Id
属性的值。指定您自己的标签值,以帮助您确定在文档生成过程中出现问题时要查找的位置。
属性:
NonCopyable | true |
数据类型: char
| string
示例
增加章节编号
import mlreportgen.dom.*; doctype = 'html'; d = Document('test',doctype); p = Paragraph('Chapter '); p.Style = {CounterInc('chapter'),WhiteSpace('preserve')}; append(p,AutoNumber('chapter')); append(d,p); p = Paragraph('Chapter '); p.Style = {CounterInc('chapter'), WhiteSpace('preserve')}; append(p,AutoNumber('chapter')); append(d,p); close(d); rptview('test',doctype);
为 CounterInc 和 CounterReset 指定多个流
为章节以及章节内的图窗指定多个计数器流。
import mlreportgen.dom.* rpt = Document('MyReport','pdf'); chapterStyle = {WhiteSpace('pre'), ... CounterReset('table figure'), ... CounterInc('chapter') ... }; topicChapterStyle = {WhiteSpace('pre'), ... CounterReset('table figure'), ... CounterInc('chapter topic') ... }; figureStyle = {WhiteSpace('pre'), ... CounterInc('figure'),Italic(true)}; chapter = Heading(1,'Chapter: '); chapter.Style = chapterStyle; append(chapter,AutoNumber('chapter')); append(chapter,' Introduction to number streams.'); append(rpt, chapter); image = append(rpt,Image(which('b747.jpg'))); image.Width = '2in'; image.Height = '2in'; para = append(rpt, Paragraph('Figure ')); para.Style = figureStyle; append(para, AutoNumber('chapter')); append(para, '.'); append(para, AutoNumber('figure')); image = append(rpt,Image(which('ngc6543a.jpg'))); image.Width = '2in'; image.Height = '2in'; para = append(rpt,Paragraph('Figure ')); para.Style = figureStyle; append(para, AutoNumber('chapter')); append(para, '.'); append(para, AutoNumber('figure')); chapter = Heading(1, 'Chapter: '); chapter.Style = topicChapterStyle; append(chapter, AutoNumber('chapter')); append(chapter,' Topic: '); append(chapter,AutoNumber('topic')); append(chapter,' How to reset and increment streams.'); append(rpt,chapter); image = append(rpt,Image(which('b747.jpg'))); image.Width = '2in'; image.Height = '2in'; para = append(rpt,Paragraph('Figure ')); para.Style = figureStyle; append(para, AutoNumber('chapter')); append(para, '.'); append(para, AutoNumber('figure')); close(rpt); rptview(rpt.OutputPath);
版本历史记录
在 R2014b 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)