Example
The following example provides header and footer text for printing the third sheet in a workbook. The header text is centered on the printed page. The footer text has both left- and right-justified portions. The sheet is printed in the landscape orientation.
C++
void CTestDlg::OnButton1()
{
VARIANT x;
x.vt = VT_I4;
x.lVal = 1;
// Define the header text
m_Spread1.SetPrintHeader("/cFiscal Year 1997");
m_Spread1.SetPrintFooter("DRAFT COPY/rDRAFT COPY");
// Print in landscape orientation
m_Spread1.SetPrintOrientation(PrintOrientationLandscape);
// Print the third sheet
m_Spread1.SetSheet(3);
// Print the sheet
m_Spread1.PrintSheet(&x);
}
Visual Basic
' Define the header text
fpSpread1.PrintHeader = "/cFiscal Year 1997"
fpSpread1.PrintFooter = "/cl""255""DRAFT COPY/rDRAFT COPY"
' Print in landscape orientation
fpSpread1.PrintOrientation = PrintOrientationLandscape
' Print the third sheet
fpSpread1.Sheet = 3
' Print the sheet
fpSpread1.PrintSheet PrintFlagsNone