method ExPrint.CopyTo (Path as String)
Copies the pages to EMF files.

TypeDescription
Path as String A String expression that specifies the path and the file names to generate the files. The Path should/may include the %i which indicates the index of the page being printed to the specified format. The index starts from 1 for the first page, 2 for second page, and so on. For instance, the C:\Temp\Print\Page%i.emf exports the pages to files such as C:\Temp\Print\Page1.emf, C:\Temp\Print\Page2.emf, and so on depending on the number of pages. 

If the Path parameter is not empty, the extension ( characters after last dot ) determines the graphical/ format of the file to be saved as follows:

  • *.bmp *.dib *.rle, exports the pages to BMP format.
  • *.jpg *.jpe *.jpeg *.jfif, exports the pages to JPEG format.
  • *.gif, , exports the pages to GIF format.
  • *.tif *.tiff, exports the pages to TIFF format.
  • *.png, exports the pages to PNG format.
  • *.pdf, exports the pages to PDF format. The %i flag has no effect if using PDF format, as all pages are saved to a single document. 
  • *.emf or any other extension determines the control to save the pages in EMF format.

 

ReturnDescription
Long0 meaning that no pages where generated or created ( due some errors like write error, not setting the PrintExt property before and so on ). Any value greater than 0 indicates the number of files being created. 
The CopyTo method copies/exports the control's view to BMP, PNG, JPG, GIF, TIFF, PDF or EMF graphical files. The CopyTo returns 0, if any error occurs, or it returns the number of files being created. The Path parameter should include a %i expression that's replaced with the index of the page being generated. If no %i sequence is included in the Path parameter the last page is saved to specified file. The files can be opened with any application that knows how to open or handle the EMF files, such as Microsoft Office Picture Manager, Microsoft PaintBrush, and so on. During CopyTo method any exiting file ( with the generated name ) is deleted before created. The PrintExt property must be specified before calling the CopyTo method, as you would do a previewing using the Preview method. If the PrintExt property is empty before calling the CopyTo method, it returns 0, and no files are created.

The following VB6 sample generates EMF files instead printing the Exontrol's ExG2antt/COM content:

With Print1
    Set .PrintExt = G2antt1.Object
    Debug.Print "Files generated: " & .CopyTo("C:\Temp\Print\Page%i.emf")
End With

The following VB/NET sample generates EMF files instead printing the Exontrol's ExG2antt/NET content:

With Exprint1
    .PrintExt = Exg2antt1
    System.Diagnostics.Debug.WriteLine("Files generated: " & .CopyTo("C:\Temp\Print\Page%i.emf"))
End With