![]() |
![]() | Understanding the CorelDRAW object model : Working with import filters and export filters : Working with export filters |
The following VBA example demonstrates how to save a document as an AutoCAD DXF file by using an export filter:
Sub SaveRectangleDXF() |
Dim FilterObject As DXFExport |
Dim BitmapType As DxfBitmapType |
Dim TextAsCurves As Boolean |
Dim Units As DxfUnits |
Dim Version As DxfVersion |
'Initialize FilterObject |
Set FilterObject = ActiveDocument.ExportEx("C:\devo\rect.dxf", _ |
cdrDXF) |
'Set the advanced features of the filter |
BitmapType = dxfBitmapGIF |
FilterObject.BitmapType = BitmapType |
Units = dxfInches |
FilterObject.Units = Units |
TextAsCurves = False |
FilterObject.TextAsCurves = TextAsCurves |
Version = dxfVersion2000 |
FilterObject.Version = Version |
'Invoke the filter |
FilterObject.Finish |
End Sub |
In the preceding example, a call is made to ActiveDocument.ExportEx method, and the interface for the export filter (DXFExport) is invoked. However, you can use the generic export interface (ExportFilter) rather than the filter-specific interface (DXFExport), as in the following VBA example:
Sub SaveRectangle() |
Dim FilterObject As ExportFilter |
'Initialize FilterObject |
Set FilterObject = ActiveDocument.ExportEx("C:\devo\rect.dxf", cdrDXF) |
'Set the advanced features of the filter |
FilterObject.BitmapType = 1 'GIF |
FilterObject.Units = 0 'Inches |
FilterObject.TextAsCurves = False |
FilterObject.Version = 1 'AutoCAD 2000 |
'Invoke the filter |
FilterObject.Finish |
End Sub |
The following VBA example demonstrates how to invoke the Export dialog box:
Sub ShowExportDialog() |
Dim FilterObject As ExportFilter |
Dim vntReturn As Variant |
'Initialize FilterObject |
Set FilterObject = ActiveDocument.ExportEx("C:\devo\rect.dxf", cdrDXF) |
'If FilterObject supports a dialog, invoke it |
If (FilterObject.HasDialog = True) Then |
vntReturn = FilterObject.ShowDialog |
'Verify that the user clicked "OK" and not "Cancel" |
If (vntReturn = True) Then |
'Invoke the filter |
FilterObject.Finish |
End If |
End If |
End Sub |
The preceding example requires you to check the return value of the dialog box, and to invoke the Finish method for when the user clicks OK.
![]() |
![]() |
![]() |
Copyright 2013 Corel Corporation. All rights reserved.