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);