Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example will print two sheets. The first sheet in the upper half of the page and the second in the lower half of the page. There will be a 1 inch margin around each of the sheets. This example assumes the printing will be done on a sheet of 8.5" X 11" paper.

C++

void COwnerPrintDrawDlg::OnButton1()
{
long PaperHeight = 15840;
long PaperWidth = 12240;
DOCINFO docinfo;
CPrintDialog dlg(FALSE);
dlg.GetDefaults();

HDC hdcPrinter = dlg.GetPrinterDC();

// Set up DOCINFO structure
memset(&docinfo, 0, sizeof(docinfo));
docinfo.cbSize = sizeof(docinfo);
docinfo.lpszDocName = _T("OwnerPrintDraw");

// call StartDoc() to begin printing
StartDoc(hdcPrinter, &docinfo);
m_Spread1.OwnerPrintDraw((long)hdcPrinter, 1440, 1440, PaperWidth - 1440, PaperHeight / 2 - 1440, 1);
m_Spread2.OwnerPrintDraw((long)hdcPrinter, 1440, PaperHeight / 2 + 1440, PaperWidth - 1440, PaperHeight - 1440, 1);
EndDoc(hdcPrinter);   
}

Visual Basic

Private Sub Command1_Click()
' These are 8.5" X 11" paper dimensions in TWIPS
    Const PaperWidth = 12240
    Const PaperHeight = 15840

    Printer.Print
    Call fpSpread1.OwnerPrintDraw(Printer.hDC, 1440, 1440, PaperWidth - 1440, PaperHeight / 2 - 1440, 1)
    Call fpSpread2.OwnerPrintDraw(Printer.hDC, 1440, PaperHeight / 2 + 1440, PaperWidth - 1440, PaperHeight - 1440, 1)
    Printer.EndDoc
End Sub

Copyright © GrapeCity, inc. All rights reserved.