Copy Page Setup Settings from Source Worksheet into Destination Worksheet

Possible Usage Scenarios

When you add a new sheet to a workbook, it contains the default Page Setup settings. There may be times when you need to transfer the settings (PageSetup) from one worksheet to another worksheet. This document explains how to copy Page Setup settings from one worksheet to another using Aspose.Cells APIs.

Copy Page Setup Settings from Source Worksheet into Destination Worksheet

The following sample code illustrates how to copy Page Setup settings from one worksheet to another using PageSetup.Copy() method. Please see the following sample code and its console output for a reference.

Sample Code

Console Output

Before Paper Size: PAPER_A_3_EXTRA_TRANSVERSE

Before Paper Size: PAPER_LETTER

After Paper Size: PAPER_A_3_EXTRA_TRANSVERSE

After Paper Size: PAPER_A_3_EXTRA_TRANSVERSE