eXPrint - FAQ
Exontrol.COM Software - Frequently Asked Questions - ExPrint Component
1:
The control's release notes can be found on our web site, looking for the Release Notes/What's new column in the control's main page. Click here for direct link.
2:
The control's assembly manifest is:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
	<assemblyIdentity name="exprint.X" version="10.1.0.2" type="win32" processorArchitecture="x86"></assemblyIdentity>
	<file name="exprint.dll" hashalg="SHA1">
		<comClass clsid="{4DEB0D2B-6EBD-4A22-9835-48AB9CDC8088}" tlbid="{ED7B66F6-C533-48E9-B536-6F3B0E9C5839}" progid="Exontrol.Print.1" description="Print Class"></comClass>
		<comClass clsid="{F8DBA669-F3DB-423C-8744-8349C3D85554}" tlbid="{ED7B66F6-C533-48E9-B536-6F3B0E9C5839}" progid="ExPrint.Page.1" description="Page Class"></comClass>
		<typelib tlbid="{ED7B66F6-C533-48E9-B536-6F3B0E9C5839}" version="1.0" helpdir="" flags="HASDISKIMAGE"></typelib>
	</file>
	<comInterfaceExternalProxyStub name="IExPrint" iid="{9895A7AD-74B6-45DE-931A-820DCFCAC2DD}" tlbid="{ED7B66F6-C533-48E9-B536-6F3B0E9C5839}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
	<comInterfaceExternalProxyStub name="IPage" iid="{F5BC675D-D093-400B-A17A-7D0B9C5AC06B}" tlbid="{ED7B66F6-C533-48E9-B536-6F3B0E9C5839}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
</assembly>
3:
Generally, the PrintExt/PrintExts (starting from 6.1) property of the eXPrint component needs to refer the object to be printed as in the following samples:

If you are using the /COM version you can ALWAYS invokes the control's Print and Print Preview using the following code, no matter of your programming language, of your development environment such as Unipaas, SmallTalk, and so on

Template = "dim p;p=CreateObject(`Exontrol.Print`);p.AutoRelease=False;p.PrintExt=Me;p.Preview()"

In other words, just call the Template property of the control with specified string ( red string ) , as you would change the control's Background color.

Next samples define the callPreview subroutine which invokes the Print and Print-Preview of eXG2antt component.

  • Access. The Object method of the G2antt1 object gets the native or the original component. 
Private Sub callPreview()
    With Print1
        Set .PrintExt = G2antt1.Object
        .preview
    End With
End Sub
  • VB6. The Object method of the G2antt1 object gets the native or the original component. 
Private Sub callPreview()
    With Print1
        Set .PrintExt = G2antt1.Object
        .Preview
    End With
End Sub
  • VFP. The Object method of the G2antt1 object gets the native or the original component. 
with thisform.Print1
	.PrintExt = thisform.G2antt1.Object
	.Preview
endwith
  • VB.NET ( /COM ). The GetOcx method of the G2antt1 object gets the native or the original component. 
Private Sub callPreview()
    With AxPrint1
        .PrintExt = AxG2antt1.GetOcx()
        .Preview()
    End With
End Sub
  • VB.NET ( /NET ). 
Private Sub callPreview()
    With Exprint1
        .PrintExt = Exg2antt1
        .Preview()
    End With
End Sub
  • VB.NET ( /WPF ). Declares and initializes a member exprint of  exontrol.EXPRINTLib.exprint type, as in the following code
Private exprint As exontrol.EXPRINTLib.exprint = New exontrol.EXPRINTLib.exprint()

Private Sub callPreview()
    With exprint
        .PrintExt = Exg2antt1
        .Preview()
    End With
End Sub
  • C# ( /COM ). The GetOcx method of the G2antt1 object gets the native or the original component. 
private void callPreview()
{
    axPrint1.PrintExt = axG2antt1.GetOcx();
    axPrint1.Preview();

}
  • C# ( /NET ). 
private void callPreview()
{
    exprint1.PrintExt = exg2antt1;
    exprint1.Preview();
}
  • C# ( /WPF ). Declares and initializes a member exprint of  exontrol.EXPRINTLib.exprint type, as in the following code:
exontrol.EXPRINTLib.exprint exprint = new exontrol.EXPRINTLib.exprint();

private void callPreview()
{
    exprint.PrintExt = exg2antt1;
    exprint.Preview();
}
  • C++ (6.0). The m_print member of the CWindowMFCDlg class, is of CExPrint type ( which has been defined by the class wizard ). The m_g2antt member is of CG2antt type that has been defined by the class wizard. The GetControlUnknown method retrieves a pointer to IUnknown interface being implemented by the original component, which is the pointer required by the PrintExt method before calling the Preview or DoPrint method of the eXPrint component.
void CWindowMFCDlg::callPreview()
{
	m_print.SetPrintExt( m_g2antt.GetControlUnknown() );
	m_print.Preview();
}
  • C++ (2005,2008). The m_print member of the CWindowMFCDlg class, is of CExPrint type ( which has been defined by the class wizard ). The m_g2antt member is of CG2antt type that has been defined by the class wizard. The GetControlUnknown method retrieves a pointer to IUnknown interface being implemented by the original component, which is the pointer required by the PrintExt method before calling the Preview or DoPrint method of the eXPrint component.
void CWindowMFCDlg::callPreview()
{
	m_print.put_PrintExt( m_g2antt.GetControlUnknown() );
	m_print.Preview();
}
  • C++ Builder (2009). The DefaultDispatch function of the TOleControl retrieves the original object, so it can be passed to PrintExt function of the eXPrint in order to print or print preview the component, as seen in the callpreview function:
void TForm1::callPreview()
{
	Print1->PrintExt = G2antt1->DefaultDispatch;
	Print1->Preview();
}
  • X++ (Dynamics Ax 2009). The PrintExt function of the eXPrint component must point to the object to be printed. The following sample shows the print-preview for the exg2antt1 component.
void callPreview()
{
    anytype var_object;
    ;

    var_object = exg2antt1;
    exprint1.PrintExt(var_object);
    exprint1.Preview();
}
  • Delphi (2009). The DefaultDispatch function of the TOleControl retrieves the original object, so it can be passed to PrintExt function of the eXPrint in order to print or print preview the component, as seen in the callpreview function:
procedure callPreview(P : TPrint; G : TG2antt);
begin
with P do
begin
 PrintExt := G.DefaultDispatch;
 Preview();
end;
end;
callPreview( Print1, G2antt1 );
  • Clarion. Code under ?PrintThis button, with some properties:
 ?Print{'Settings(10)'} = 1
 ?Print{'PrintExt'} = ?Gantt{PROP:Object}            ! If we going to print ExG2antt
 ?Print{'AsScreen'} = False                          ! Sometimes makes problems under Terminal services
 ?Print{'PageOrientation'} = 2
 ?Print{'Caption'} = 'Some text'
 ?Print{'Settings(6)'} = 1500
 ?Print{'Settings(7)'} = 1500
 ?Print{'Settings(8)'} = 1500
 ?Print{'Settings(9)'} = 1500
 ?Print{'Font.Name'}   = 'Arial'
 ?Print{'Font.Size'}   = 9
 ?Print{'Preview'}
  • PowerBuilder (Classic). The Object property of the control (OLECustomControl) returns the OLE object to be passed to PrintExt property of the eXPrint like in the following code:

Defines the callPreview new function with one argument g of OLECustomControl type. The print object indicates the name of the eXPrint in the Window. The following code, can be used when the ExPrint is added in design mode, to the Layout page:

// callPreview( olecustomcontrol g ) returns (none)
OLEObject oPrint

oPrint = print.Object
oPrint.PrintExt = g.Object
oPrint.Preview()

The following callPreview function uses the eXPrint being created at runtime. Declare the OLEObject oPrint in the Instance Variables page, so the oPrint is known at the time the callPreview is called, so the callPreview looks as follows:

// callPreview( olecustomcontrol g ) returns (none)

oPrint = CREATE OLEObject
oPrint.ConnectToNewObject("Exontrol.Print")

oPrint.PrintExt = g.Object
oPrint.Preview()

The callPreview(ole_1) should be called to invoke the print-preview of ole_1 object. In this case the ole_1 is the ExG2antt component hosted in the Window.

  • dBASE Plus. The nativeObject property of the control (ActiveX) returns the OLE object to be passed to PrintExt property of the eXPrint like in the following code:

Defines the preview new method with one argument g. The OEXPRINT object indicates the name of the eXPrint in the form. The following code, can be used when the ExPrint is added in design mode, to the form:

function callPreview(o)
   local oPrint
   oPrint = form.OEXPRINT.nativeObject
      oPrint.PrintExt = o
      oPrint.Preview()
return

while, the following call can be used to print and print-preview the control :

CLASS::callPreview(form.Activex1.nativeObject)

where the ActiveX1 is the name of the control to be printed, in this case is the ExG2antt Chart ActiveX Control.

The following preview function uses the eXPrint being created at runtime. Declare the public oPrint in as a global variable, so the oPrint is known at the time the preview is called, so the method shows as follows:

function callPreview(o)
   oPrint = new OleAutoClient("Exontrol.Print")
      oPrint.PrintExt = o
      oPrint.Preview()
return

while, the following call can be used to print and print-preview the control :

CLASS::callPreview(form.Activex1.nativeObject)

where the ActiveX1 is the name of the control to be printed, in this case is the ExG2antt Chart ActiveX Control.

  • Visual DataFlex. The simplest way to call the Print and Print/Preview for the component, is using the Template property of the control as in the following sample

Defines the preview procedure as follows:

Procedure preview Handle g

    Set ComTemplate of g to "dim p;p=CreateObject(`Exontrol.Print`);p.AutoRelease=False;p.PrintExt=Me;p.Preview()"
    
End_Procedure

while, the following call can be used to print and print-preview the control :

Send preview Self

where the Self indicates the handle of the control to be printed, in this case is the ExG2antt Chart ActiveX Control ( oComG2antt ). This method does not require importing the "ExPrint 1.0 Control Library ( version 1.0 )" to your workspace.

The following method requires, importing the "ExPrint 1.0 Control Library ( version 1.0 )" to your workspace. Check how you imported the  "ExG2antt 1.0 Control Library (version 1.0)" and do the same.

Procedure preview Variant g
    
    Handle hoPrint
    Get Create (RefClass(cComPrint)) to hoPrint
    Set ComAutoRelease of hoPrint to True
    Set ComPrintExts of hoPrint to g
    Send ComPreview of hoPrint
    //Send Destroy to hoPrint   // Prevents closing the Print object, so the Preview will not be shown. AutoRelease will release the object once the Close button is pressed
    
End_Procedure

while, the following call can be used to print and print-preview the control :

Send preview (pvComObject(Self))

where the Self indicates the handle of the control to be printed, in this case is the ExG2antt Chart ActiveX Control ( oComG2antt ).

  • Xbase++ The simplest way to call the Print and Print/Preview for the component, is using the Template property of the control as in the following sample

Defines the preview procedure as follows:

PROCEDURE _preview( oControl )
   oControl:Template := "dim p;p=CreateObject(`Exontrol.Print`);p.AutoRelease=False;p.PrintExt=Me;p.Preview()"
RETURN

while, the following call can be used to print and print-preview the control :

_preview( oControl )

where the oControl indicates the control to be printed, in this case is the ExG2antt Chart ActiveX Control ( oControl ). This method does not require creating the "ExPrint 1.0 Control Library ( version 1.0 )" to your project.

The following method requires, creating and using the Preview method of the the "ExPrint 1.0 Control Library ( version 1.0 )" object.

PROCEDURE _preview( oPrint, oControl )
   oPrint:AutoRelease := .F.
   oPrint:PrintExt := oControl
   oPrint:Preview()
RETURN

while, the following call can be used to print and print-preview the control :

_preview( oPrint, oControl )

where the oControl indicates the the control to be printed, in this case is the ExG2antt Chart ActiveX Control ( oControl ), and the oPrint is the "ExPrint 1.0 Control Library ( version 1.0 )" object created using the following code:

oPrint := XbpActiveXControl():new( oForm:drawingArea )
oPrint:CLSID  := "Exontrol.Print"
oPrint:create()
4:
The eXPrint control provides the Caption property that specifies the name / caption to be displayed on the page.
With Print1
    .Caption = "This is a new caption to be shown"
    Set .PrintExt = Grid1.Object
    .Preview
End With
The Caption property should be called before Preview/DoPrint method.
5:
The eXPrint control provides the ItemCaption property which changes the captions to be shown on the toolbar of the Print/Print Preview. The ItemToolTip property specifies the tooltip assigned to buttons on the print and print's preview toolbar.
With Print1
    .ItemCaption(exToolBarSetup) = "<img>4</img>Einrichtungsdatei..."
    .ItemToolTip(exToolBarSetup) = .ItemCaption(exToolBarSetup)
    .ItemCaption(exToolBarClose) = "<img>6</img>Schließen"
    .ItemToolTip(exToolBarClose) = .ItemCaption(exToolBarClose)
    .ItemCaption(exToolBarPrint) = "<img>5</img>Ausdrucken"
    .ItemToolTip(exToolBarPrint) = .ItemCaption(exToolBarPrint)
    Set .PrintExt = G2antt1.Object
    .Preview
End With
The ItemCaption property should be called before Preview/DoPrint method.
6:
The eXPrint control provides the PageOrientation or Settings(exPageOrientation) property specifies the page's orientation. The following sample changes the page's orientation to landscape:
With Print1
    .PageOrientation = exLandscape
    Set .PrintExt = G2antt1.Object
    .Preview
End With

or:

With Print1
    .Settings(exPageOrientation) = 2
    Set .PrintExt = G2antt1.Object
    .Preview
End With
The PageOrientation or Settings(exPageOrientation) property should be called before Preview/DoPrint method.
7:
The eXPrint control provides the Settings(exPaperSize) property specifies the size of the page. The following sample changes the page's size to A4:
With Print1
    .Settings(exPaperSize) = 9
    Set .PrintExt = G2antt1.Object
    .Preview
End With
The Settings(exPaperSize) property should be called before Preview/DoPrint method.
8:
The grid lines or dotted lines may not be shown on the printer devices. You have the following options:
  • change the AsScreen property to True.
  • change the style of grid line to a solid line, during printing

The following VB sample changes the AsScreen property:

With Print1
    .AsScreen = True
    Set .PrintExt = G2antt1.Object
    .Preview
End With

The following VB sample changes the style of grid lines property, using the Refreshing/Refresh events:

Dim nGridLineStyle As Long

Private Sub Print1_Refreshing()
    nGridLineStyle = G2antt1.GridLineStyle
    G2antt1.GridLineStyle = exGridLinesSolid
End Sub

Private Sub Print1_Refresh()
    G2antt1.GridLineStyle = nGridLineStyle
End Sub

With Print1
    Set .PrintExt = G2antt1.Object
    .Preview
End With

The following VB sample changes the style of grid lines property:

With Print1
    Dim nGridLineStyle As Long
    nGridLineStyle = G2antt1.GridLineStyle
    G2antt1.GridLineStyle = exGridLinesSolid
    Set .PrintExt = G2antt1.Object
    .Preview
    G2antt1.GridLineStyle = nGridLineStyle
End With
9:
The eXPrint control communicates with the object to be printed, and generally the way the control shows on the screen, the same data is sent to the eXPrint component. So, if you need to provide a different view in the Print and Print-Preview, you need to handle the Refreshing and Refresh events. The Refreshing event is sent just before the eXPrint is doing the previewing, while the Refresh event is called once all control is previewed. In conclusion, the idea is to change the control on the back to look as you want to get in the preview, and restore the state when Refresh event occurs. 

In the following sample, we print no columns for the eXG2antt control:

Private Sub Print1_Refreshing()
    With G2antt1
        .BeginUpdate
        For Each c In .Columns
            c.Visible = False
        Next
    End With
End Sub

Private Sub Print1_Refresh()
    With G2antt1
        For Each c In .Columns
            c.Visible = True
        Next
        .EndUpdate
    End With
End Sub

The sample hides all the columns during the Refreshing event, and locks the update of the control during previewing, and restore all columns ( visibility ) when Refresh event is called. 

Basically, Refreshing/Refresh is the idea of how you can personalize the view of your Print and Print-Preview for any of our controls.
10:
The eXPrint control provides HTMLPicture to load pictures from your file, resources or BASE64 encoded-strings. Having this, you can use the <img> HTML tag to Caption or ExtraCaption property to include your logo to header/footer of each printed page.

The following sample shows how you can display your logo in the Print and Print-Preview:

With CreateObject("Exontrol.Print")
	.PageOrientation = 2
	.HTMLPicture("logo") = "E:\exontrol.logo.png"
	.ExtraCaption "logo","<img>logo</img>",1,1
	.PrintExt = Control.Object
	.Preview 
End With

and you should get something like:

11:
The eXPrint control provides the PreviewState property, which returns or sets the visual state of preview mainframe at runtime.

The following sample shows how you can maximize the print and print-preview mainframe:

Set p = CreateObject("Exontrol.Print")
With p
    .PrintExt = Control.Object
    .PreviewState = exPreviewStateMaximized
    .Preview
End With
12:

The quality of the Print and Print-preview suffer when using any of the following properties:

  • AsScreen property on True ( Semi-Transparent objects )
  • Options property includes the FitToPage field ( Fit-To-Page feature )

The Print and Print-Preview show the best on 100%, but the quality of the Print-Preview is losing once you magnify the page, no matter of the Settings(exPrintQuality) property.

What can I do? You can check if the component provides the CopyTo method, and use it to save the control's data to an EMF file, which can be opened with and editor such of Microsoft Paint, or any other that can handle EMF files. The EMF is used as a graphics language for printer drivers. Microsoft recommends that "Windows-format" (WMF) functions only "rarely" be used and "enhanced-format" (EMF) functions be used instead. The EMF file may not be created in case it is too large ( the control's data is too large ). The CopyTo method is available for components like eXGrid, eXG2antt, and so on. The eXPrint's CopyTo method copies the generated pages to different file types such as: EMF, BMP, JPG, PDF and so on.

How-To Questions
General Questions