ch1 = Chapter();
ch1.Title = 'First Chapter';
sec = Section('First Section of Chapter 1');
txt = ['This is the first section of chapter 1. ',...'The first page number for this ',...'chapter is 1, which is the default. ',...'The page orientation is also the default.'];
append(sec,txt);
append(ch1,sec);
append(rpt,ch1);
添加第二章,将编号重置为 1,并将页面方向设置为横向。
ch2 = Chapter();
ch2.Title = '2nd chapter';
ch2.Layout.FirstPageNumber = 1;
ch2.Layout.Landscape = true;
sec = Section('First Section of Chapter 2');
txt = ['This is the first section of chapter 2. ',...'The first page number is set to 1 and the ',...'page orientation is set to landscape.'];
append(sec,txt);
append(ch2,sec);
append(rpt,ch2);
ch3 = Chapter();
ch3.Title = '3rd chapter';
sec = Section('First Section of Chapter 3');
txt = ['This is the first section of chapter 3. ',...'Neither first page number nor page ',...'orientation is set for this chapter. ',...'The first page number uses the default, ',...'which continues from the previous page. ',...'The page orientation also uses the default, ',...'which is portrait.'];
append(sec,txt);
append(ch3,sec);
append(rpt,ch3);