krutoff пишет
цитата: |
Попробую сделать пока отдельную функцию, а потом переведу в метод класса... |
|
Может достаточно так сделать
METHOD ExcelOle( cXlsFile, lActivate, hProgress, cTitle, hFont, lSave, bExtern, aColSel, bPrintRow ) CLASS TSBrowse
LOCAL oExcel, oBook, oSheet, nRow, nCol, uData, nEvery, oRange, cRange, cCell, cLet, nColHead, nVar, ;
cText, nStart, nTotal, aFont, aRepl, hFntTitle, ;
nLine := 1, ;
nCount := 0, ;
nRecNo := ( ::cAlias )->( RecNo() ), ;
nAt := ::nAtPos, ;
aCol := { 26, 52, 78, 104, 130, 156 }, ;
aLet := { "", "A", "B", "C", "D", "E" }, ;
nOldRow := ::nLogicPos(), ;
nOldCol := ::nCell, ;
lSelector := ::lSelector
LOCAL nTmp, cTmp
...
uData := ::bDataEval( ::aColumns[ nCol ] )
IF ValType( uData ) == "C"
oSheet:Cells( nLine, nCol ):NumberFormat := "@"
IF At( CRLF, uData ) > 0
uData := StrTran( uData, CRLF, "&&" )
IF AScan( aRepl, nCol ) == 0
AAdd( aRepl, nCol )
ENDIF
ENDIF
ENDIF
//IF ::aColumns[ nCol ]:cPicture != NIL .AND. uData != NIL
// uData := Transform( uData, ::aColumns[ nCol ]:cPicture )
//ENDIF
IF ValType( uData ) == "N"
IF ::aColumns[ nCol ]:cPicture != NIL
uData := Transform( uData, ::aColumns[ nCol ]:cPicture )
ELSE
uData := cValToChar(uData)
ENDIF
cTmp := "#0"
IF ( nTmp := AT(".", uData) ) > 0
cTmp := Repl("#", nTmp - 2) + '0,' + Repl("0", Len(uData) - nTmp)
ENDIF
oSheet:Cells( nLine, nCol ):NumberFormat := cTmp
ELSE
IF ::aColumns[ nCol ]:cPicture != NIL .AND. uData != NIL
uData := Transform( uData, ::aColumns[ nCol ]:cPicture )
ENDIF
uData := iif( ValType( uData ) == "D", DToC( uData ), iif( ValType( uData ) == "N", Str( uData ), ;
iif( ValType( uData ) == "L", iif( uData, ".T.", ".F." ), cValToChar( uData ) ) ) )
ENDIF
cText += Trim( uData ) + Chr( 9 )
...
и собрать tsbrowse.lib, запустив MakeLib.bat