Example
The following example adds data to the first sheet, then in a command button sets the scaling method to zoom the sheet to 75% and prints the sheet.
C++
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
int i;
int j;
// Add data
m_Spread.SetSheetCount(2);
m_Spread.SetSheet(1);
m_Spread.SetMaxCols(10);
m_Spread.SetMaxRows(30);
for (i=1; i<11; 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 zoom
m_Spread.SetPrintScalingMethod(PrintScalingMethodZoom);
// Set zoom factor
m_Spread.SetPrintZoomFactor(.75);
// 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 = 10
fpSpread1.MaxRows = 30
For i = 1 To 10
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
fpSpread1.PrintScalingMethod = PrintScalingMethodZoom
' Set zoom factor
fpSpread1.PrintZoomFactor = 0.75
' Print
fpSpread1.PrintSheet 0
End Sub