Hi there,
I try to run this code, but I always get an error like : Method SaveAs failed to run on Object IDrawBitmap ?
Any ideas ?
Sub Test()
Dim r As Shape, s As ShapeSet r = ActiveLayer.CreateRectangle(0, 0, 5, 5) r.Fill.UniformColor.CMYKAssign 100, 0, 0, 0 Set s = ActiveLayer.CreateEllipse2(3, 3, 2) s.Fill.UniformColor.CMYKAssign 0, 100, 100, 0 Set s = s.ConvertToBitmapEx(cdrRGBColorImage, False, True) s.CreateDropShadow cdrDropShadowFlat, 80, 10, 0.5, -0.5, CreateCMYKColor(0, 50, 50, 50)
r.CreateSelections.Selected = True
If (s.Type = cdrBitmapShape) Then MsgBox "isBitmapShape"
Dim ex As ExportFilter
Set ex = s.Bitmap.SaveAs("c:\newBMP.bmp", cdrBMP, cdrCompressionRLE_LW)
End Sub
Hi.
Try specifiaclly converting it to a bitmap. I added one line to your code:
Sub Test3333()Dim r As Shape, s As ShapeSet r = ActiveLayer.CreateRectangle(0, 0, 5, 5)r.Fill.UniformColor.CMYKAssign 100, 0, 0, 0Set s = ActiveLayer.CreateEllipse2(3, 3, 2)s.Fill.UniformColor.CMYKAssign 0, 100, 100, 0Set s = s.ConvertToBitmapEx(cdrRGBColorImage, False, True)s.CreateDropShadow cdrDropShadowFlat, 80, 10, 0.5, -0.5, CreateCMYKColor(0, 50, 50, 50)r.CreateSelections.Selected = True If (s.Type = cdrBitmapShape) Then MsgBox "isBitmapShape" Dim ex As ExportFilter Set s = s.ConvertToBitmapEx(cdrRGBColorImage, True, False, 300, 300, False) Set ex = s.Bitmap.SaveAs("d:\All Graphics\newBMP.bmp", cdrBMP, cdrCompressionRLE_LW)ex.FinishEnd Sub
~John
I use CorelDraw X3 and have same trouble...
ConvertToBitmapEx has different parameters from what you indicated...
From first to last:
Mode
Sets the image type and returns cdrImageType. [in]
Optional
Default value = cdrRGBColorImage (4)
Dithered
Enables dithering if set to True (-1) [in]
Default value = False
Transparent
Enables a transparent background if set to True (-1) [in]
Resolution - it is only one parameter for both axes (not as you had indicated)
Sets the resolution [in]
Default value = 72
AntiAliasing
Sets the anti-aliasing which returns cdrAntiAliasingType [in]
Default value = cdrNormalAntiAliasing (1)
UseColorProfile
Uses the color profile if set to TRUE (-1) [in]
Default value = True
and some optional parameters that are not indicated in help, but visible in vba hints is:
OlwaysOverprintBlack as Boolean = False
OverprintBlackLimit as Long = 95
I've tryed to change filter options, compression in Bitmap.SaveAs, but had no success...
Can anybody help with it?
Set s = s.ConvertToBitmapEx(cdrRGBColorImage, True, False, 300, 300, False)
Set ex = s.Bitmap.SaveAs("Let me choose", cdrBMP, cdrCompressionRLE_LW)
John, is there any way to do an export with preset parameters but let me choose the directory and name first? Seems cd wants you to first choose name and directory then set parameters. Might be easier to create macros if it were the other way around.