HotXLS 文档

SetPrintArea 方法

使用基于 1 的行和列索引号设置要打印的区域,作为基于字符串的 PrintArea 属性的替代方案

语法

procedure SetPrintArea(FirstRow: Word; FirstCol: Word; LastRow: Word; LastCol: Word);
FirstRow 必填 Word。打印区域第一行的基于 1 的行索引
FirstCol 必填 Word。打印区域第一列的基于 1 的列索引
LastRow 必填 Word。打印区域最后一行的基于 1 的行索引
LastCol 必填 Word。打印区域最后一列的基于 1 的列索引

备注

FirstRow、FirstCol、LastRow 和 LastCol 使用与 Cells 属性相同的基于 1 的编号。当 FirstRow > LastRow、FirstCol > LastCol 或索引超出工作表边界时,调用会被忽略

示例

此示例将工作表一的打印区域设置为单元格 A1:E20

Workbook.Sheets[1].PageSetup.SetPrintArea(1, 1, 20, 5);