Yes at first look printing is a problem. Using dibapi32.dll (available for download from MS with source) it is easy. I save graphs as bmp, show on report using oleboundcontrol/picture with expression (filename), report and erase them. Multiple charting, saving to bmp is faster than creating a single chart with others that I tested. Report shows up instantly as if it doesn't contain any charts. ie: (parts of operation):
Local oCharter
oCharter=Createobject('charter')
Select myReportCursor
scan
oCharter.Copy2Clipboard()
lcGraphFile = Forcepath(Sys(2015)+".bmp", Sys(2023))
if ClipBoard2BMP(m.lcGraphFile)
replace GraphFile with m.lcGraphFile
endif
EndScan
Procedure ClipBoard2BMP
Lparameters tcFileName
Local llResult,lcFileName
#Define CF_DIB 8
Declare short IsClipboardFormatAvailable In win32api Integer cbformat
Declare Integer GetClipboardData In win32api Integer uFormat
Declare Integer OpenClipboard In win32Api Integer hWndNewOwner
Declare Integer CloseClipboard In win32Api
Declare Integer SaveDIB In DibAPI32.Dll Integer hBitmap, String @ cFileName
Declare Integer GetSystemPalette In DibAPI32.Dll
Declare Integer GetActiveWindow In win32Api
lcFileName = Fullpath(Iif(Empty(m.tcFileName),;
PUTFILE("Save as Bitmap", 'FromClipBoard', "BMP"), ;
m.tcFileName))
If !Empty(m.lcFileName) and ( IsClipboardFormatAvailable(CF_DIB) # 0 )
IF ( OpenClipboard(GetActiveWindow()) != 0 )
llResult = ( SaveDIB(GetClipboardData( CF_DIB ), @lcFileName) = 0)
CloseClipboard()
endif
Endif
Return m.llResult
Procedure Copy2Clipboard
With This.Chart
.SelectPart(1,1,1,1,1)
.EditCopy
Endwith
Endproc
Cetin
>Cetin,
>
>Hi. Yes, I was hoping for your opinion again. One of the things that came up was printing. I saw some posts indicating that printing was problematic with MSChart, then again, saw others indicating a resolution of that. Printing is a key factor.
>
>>David,
>>Why are you CCing? Asking my opinion? If so I repeat MSChart.
>>Cetin
>>
>>>Marcia,
>>>
>>>Thanks!
>>>
>>>I guess I'll end up trying all of these methods at some point.
>>>
>>>For starters though I've downloaded the west wind stuff and am testing it now. I've got my own sample data working. The class seems pretty straightforward to use.
>>>
>>>
>>>>
Since I know the VFP report writer reasonably well this method seems appealing. It seems like less of a learning curve than MSChart or MSGraph.>>>>
>>>>Piece of cake to use MsGraph or Excel Automation to print in a report. You just use an oleBound Control in the report, just like the code sample. I do not know if there are still issues with images refreshing in reports - I know there used to be.
>>>>
>>>>
One consideration, though, is that although they haven't asked for it yet, I'm anticipating that down the road the users might want 'their original spreadsheet back'. Meaning that they might want to play with the output on their own. If that's the case, then I'm thinking that in the long run I have to use OLE Automation anyway?>>>>
>>>>Seems sensible to me.
>>>>
>>>>
Your article was written in 2002. Are the options fundamentally the same now? Or are there other issues or new implementations to consider?>>>>
>>>>Not that I know of....