A6是多大啊?Excel中没预置这个尺寸?
授人以渔,不授人以鱼。
CLEAR ALL CLEAR Main() CLEAR ALL RETURN PROCEDURE Main() LOCAL loFileName, loExcel, lnRow, lnCol, lnIndex, lcField IF !USED("工资") USE test_prn ALIAS 工资 IN 0 ENDIF loFileName = Application.DefaultFilePath + "\工资条" IF FILE(loFileName + ".xls") loFileName = loFileName + ".xls" DELETE FILE (loFileName) ELSE IF FILE(loFileName + ".xlsx") loFileName = loFileName + ".xlsx" DELETE FILE (loFileName) ENDIF ENDIF WAIT "正在启动 Microsoft Excel Application,请稍候……" WINDOW NOWAIT loExcel = CREATEOBJECT("Excel.Application") WAIT "正在生成工资条,请稍候……" WINDOW NOWAIT WITH loExcel .SheetsInNewWorkbook = 1 .Workbooks.Add .WorkSheets(1).Activate lnRow = -1 lnCol = 0 SELECT 工资 SCAN ALL lnRow = lnRow + 2 lnCol = 1 FOR lnIndex = 1 TO FCOUNT() lcField = FIELD(lnIndex) IF !EMPTY(EVALUATE(lcField)) .ActiveSheet.Rows(lnRow).HorizontalAlignment = 3 .Cells(lnRow, lnCol).Value = lcField .Cells(lnRow + 1, lnCol).Value = TRANSFORM(EVALUATE(lcField)) lnCol = lnCol + 1 ENDIF NEXT ENDSCAN .ActiveWorkbook.SaveAs(loFileName) .Quit ENDWITH RELEASE loExcel WAIT "工资条已生成" WINDOW ENDPROC