CopyPageToClipboard([nPageNumber]) Copies the current page or the specified page to the clipboard. AddFromClipboard(cName, nHPos, nVPos, nWidth, nHeight) * Adds the current Clipboard object onto the current page programmatically. SaveToMetafile(cFileName, [nPageNumber], [lOpenfile]) * Saves the current page or the Page specified to a Metafile. SaveToBitmap(cFileName, [nPageNumber = 0], [lOpenFile = .F.], [nThumbnailSize = 0], [nBitsPerPixel = 24], [lGrayScale = .F.]) * Saves the current page or the Page specified to a Bitmap. SaveToJPEG(cFileName, [nPageNumber = 0], [lOpenFile = .F.], [nThumbnailSize = 0], [lGrayScale = .F.], [nCompressionQuality = 90], [lProgressiveEncoding = .F.]) * Saves the current page or the Page specified to a JPEG. * lAutoOpenFile uses ShellExecute() to open the default viewer for the file after it is generated. * nThumbnailSize allows you to specify the maximum Width or Height of the BITMAP or JPEG image. This allows you * to quickly render Thumbnail images of every page in a report. * I rendered 100,000 thumbnails yesterday in about 45 minutes at 120 pixels with an nCompressionQuality of 75%I also posted code to take a report and stuff it into a WORD Document using the Clipboard which is extremely fast since it is pasting in Metafile images of each and every page rather than adding in each and every object drawn onto the page. These report pages cannot be edited but they are fully scaleable and are also rendered exactly as if they were previewed on the screen. The code below took 4.9 seconds to render a 126 page report with a lot of lines, shapes and text into my Report Engine and then it only took 3.9 seconds to paste all of the pages into a Word Document programmatically. The REPORTTOWORD.PRG file is in the BETA 4 download as well.
SET CLASSLIB TO MindsEyeReportEngine LOCAL lnSeconds, lcFRX PUBLIC o, oRPT o = CREATEOBJECT('MindsEyeReportEngine') lcFRX = GETFILE('FRX') IF EMPTY(lcFRX) THEN MESSAGEBOX("No FRX Report File Selected",16,'Report To Word') RETURN ENDIF oRPT = o.ReportFormObject(lcFRX) IF VARTYPE(oRPT) # 'O' MESSAGEBOX("Mind's Eye Report Engine was Not Instantiated",16,'Report To Word') RETURN ENDIF PUBLIC oWord * * INSTANTIATE WORD APPLICATION * oWord = CREATEOBJECT('Word.Application') IF VARTYPE(oWord) # 'O' MESSAGEBOX('WORD Could Not Be Instantiated',16,'Report To Word') RETURN ENDIF lnSeconds = SECONDS() * * CREATE A NEW DOCUMENT * oWord.Documents.Add oDoc = oWord.ActiveDocument * * SETUP THE PAGE MARGINS * THE MARGINS CAN BE VERY SMALL OR EVEN SET TO ZERO SINCE THE PAGES WERE RENDERED AT FULL SIZE * AND INCLUDE THE MARGINS IN THEM FROM THE REPORT ENGINE. * oDoc.PageSetup.TopMargin = 20 oDoc.PageSetup.BottomMargin = 20 oDoc.PageSetup.LeftMargin = 20 oDoc.PageSetup.RightMargin = 20 * * NOW COPY THE FIRST PAGE OF THE REPORT ONTO THE CLIPBOARD * oRPT.oReportEngine.FirstPage() oDoc.PageSetup.PageWidth = MIN(MTON(oRPT.oReportEngine.PageWidth * 72),22*72) oDoc.PageSetup.PageHeight = MIN(MTON(oRPT.oReportEngine.PageHeight * 72),22*72) oRPT.oReportEngine.CopyPageToClipboard(1) oDoc.Content.Paste * * NOW LOOP THROUGH THE REST OF THE PAGES IN THE REPORT ENGINE AND COPY EACH * PAGE TO THE CLIPBOARD AND PASTE THEM INTO NEW SECTIONS FOR i = 2 TO oRPT.oReportEngine.nTotalpages oRPT.oReportEngine.GoToPage(i) oDoc.Sections.Add oSection = oDoc.Sections(oDoc.Sections.Count) oSection.PageSetup.PageWidth = MIN(MTON(oRPT.oReportEngine.PageWidth * 72),22*72) oSection.PageSetup.PageHeight = MIN(MTON(oRPT.oReportEngine.PageHeight * 72),22*72) oRPT.oReportEngine.CopyPageToClipboard(i) oSection.Range.Collapse oSection.Range.Paste ENDFOR MESSAGEBOX("Report Engine Pasting into Word Complete"+CHR(13)+; "Processed in: "+STR(SECONDS() - lnSeconds,8,3),0,'Report To Word') * * NOW MAKE WORD VISIBLE. IT IS MUCH FASTER TO RUN WITH WORD NOT VISIBLE * AS WE ADD IN ALL OF THE PAGES TO THE WORD DOCUMENT. oWord.Visible = .t.You can download BETA 4 now from the website to play with these new features. I am working on Documenting all of these new features. There is too much stuff to document. <bg>