关于vfp调用Excel【只预览不打开文件】的问题?
eole.visible=.t.eole.ActiveSheet.PrintPreview && 打印预览工作表eole.visible=.f.
SET DATE YMDSET CENTURY ONCDBFFILE = GETFILE("dbf")IF EMPTY(CDBFFILE) RETURNENDIFSELECT * FROM JUSTSTEM(CDBFFILE) INTO CURSOR FOXTABLEJLS=TRANSFORM(RECCOUNT()+1)CEXCELFILE = PUTFILE("保存为(&N):",JUSTSTEM(CDBFFILE)+".xls","xls")IF EMPTY(CEXCELFILE) RETURNENDIFSELECT FOXTABLEOEXCELSHEET = GETOBJECT("","Excel.Sheet")IF NOT TYPE("oExcelSheet") = "O" =MESSAGEBOX("Excel对象创建失败,程序将中止!", 16, "Error") RETURNENDIFOEXCEL = CREATEOBJECT("excel.application")WITH OEXCEL .WORKBOOKS.ADD .SHEETS("Sheet1").SELECT .SHEETS("Sheet1").NAME = "sample" .VISIBLE=.f. .DISPLAYALERTS = .F. .CELLS.SELECT WITH .SELECTION.FONT .NAME = "宋体" .SIZE = 10 ENDWITHENDWITHOEXCEL.ACTIVESHEET.ROWS(1).ROWHEIGHT=24OEXCEL.ACTIVESHEET.ROWS('2:&JLS').ROWHEIGHT=20FOR I = 1 TO FCOUNT() OEXCEL.ACTIVESHEET.COLUMNS(I).COLUMNWIDTH=FSIZE(FIELD(I)) OEXCEL.CELLS(1,I).VALUE = FIELD(I)ENDFOROEXCEL.SELECTION.HORIZONTALALIGNMENT=2SCAN FOR I=1 TO FCOUNT() MFIELD=FIELD(I) WAIT WINDOW TRANSFORM(RECNO()) + "/"+ TRANSFORM(RECCOUNT()) NOWAIT OEXCEL.CELLS(RECNO()+1,I).VALUE=&MFIELD ENDFORENDSCANoexcel.visible=.t.oexcel.ActiveSheet.PrintPreview oexcel.visible=.f.OEXCEL.ACTIVEWORKBOOK.SAVEAS(CEXCELFILE)OEXCEL.QUITRELEASE OEXCELWAIT CLEAR=MESSAGEBOX("转换完毕!", 64, "OK")