Example
The following example adds data to the first sheet, then in a command button sets the scaling method to print using the best fit, printing two pages vertically on the printed page.
C++
CDialog::OnInitDialog();
int i;
int j;
// Add data
m_Spread.SetSheetCount(2);
m_Spread.SetSheet(1);
m_Spread.SetMaxCols(10);
m_Spread.SetMaxRows(70);
for (i=1; i<11; i++)
{
for (j=1; j<71; j++)
{
m_Spread.SetCol(i);
m_Spread.SetRow(j);
m_Spread.SetText("test");
}
}
void CAboutDlg::OnOK()
{
// Set the sheet to print
m_Spread.SetSheet(1);
// Set scaling method to best fit
m_Spread.SetPrintScalingMethod(PrintScalingMethodBestFit);
// Set number of pages
m_Spread.SetPrintBestFitPagesTall(2);
m_Spread.PrintSheet(0);
}
Visual Basic
Private Sub Form_Load()
' Create data
Dim i As Integer
Dim j As Integer
fpSpread1.SheetCount = 2
fpSpread1.Sheet = 1
fpSpread1.MaxCols = 10
fpSpread1.MaxRows = 70
For i = 1 To 10
For j = 1 To 70
fpSpread1.Col = i
fpSpread1.Row = j
fpSpread1.Text = i & j
Next j
Next i
End Sub
Private Sub Command1_Click()
' Set the sheet to print
fpSpread1.Sheet = 1
' Set scaling method to best fit
fpSpread1.PrintScalingMethod = PrintScalingMethodBestFit
' Set number of pages
fpSpread1.PrintBestFitPagesTall = 2
fpSpread1.PrintSheet 0
End Sub