Examples:
The following VBA example creates a new crop-options class. It then imports a JPEG file and crops it depending on the value for CustomData. Before the crop is applied, the original settings of the image are displayed. To try out this code example, copy the following lines of code into a new class module named cCrop:
Option Explicit Implements IImportCropHandler Private Function IImportCropHandler_Crop(Options As IStructImportCropOptions) As Boolean
Dim s As String
s = "Original Settings: " & vbCr
s = s & "DpiX: " & Options.DpiX & vbCr
s = s & "DpiY: " & Options.DpiY & vbCr
s = s & "FileName: " & Options.FileName & vbCr
s = s & "Filter: " & Options.FilterID & vbCr
s = s & "ImageHeight: " & Options.ImageHeight & vbCr
s = s & "ImageWidth: " & Options.ImageWidth & vbCr
' Display the original settings in a message box
MsgBox s
' If the custom data is set to 7 then crop half of the original; otherwise, subtract 0.5 units from the height and width.
If Options.CustomData = 7 Then
Options.Height = Options.Height / 2
Options.Width = Options.Width / 2
Options.Top = Options.Top / 2
Options.Left = Options.Left / 2
Else
Options.Height = Options.Height - 0.5
Options.Width = Options.Width - 0.5
End If End Function