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 horizontally on the printed page.
C++
CDialog::OnInitDialog();
int i;
int j;
// Add data
m_Spread.SetSheetCount(2);
m_Spread.SetSheet(1);
m_Spread.SetMaxCols(20);
m_Spread.SetMaxRows(30);
for (i=1; i<21; i++)
{
for (j=1; j<31; 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.SetPrintBestFitPagesWide(2);
// Print
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 = 20
fpSpread1.MaxRows = 30
For i = 1 To 20
For j = 1 To 30
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.PrintBestFitPagesWide = 2
fpSpread1.PrintSheet 0
End Sub