Changeset eb2b9dd in tol
- Timestamp:
- Feb 16, 2011, 7:33:52 PM (16 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 03befc6
- Parents:
- 26e0c37
- File:
-
- 1 edited
-
tol/contrib/excel/tolExcel.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/contrib/excel/tolExcel.cpp
r26e0c37 reb2b9dd 398 398 } 399 399 #endif 400 assert( cell );401 400 if ( cell ) { 402 401 CellFormat fmt( *m_ptrFmtMgr, cell ); … … 422 421 snprintf( cell_coord, 64, "(%d,%d)", row, col ); 423 422 Warning( err_name + ": " + 424 I2("don't know how to interpret the result in cell ",423 I2("don't know how to interpret the result in cell formula ", 425 424 "no se como interpretar el resultado en la celda " ) + cell_coord ); 426 result = new BContensText( "" ); 425 // OJO: aqui hay que retornar NULL y dejar que el que llama tome la decision. 426 result = NULL; 427 //result = new BContensText( "" ); 427 428 } 428 429 break; … … 434 435 "no se que hacer con la celda " ) + cell_coord ); 435 436 #endif 436 result = new BContensText( "" ); 437 result = NULL; 438 // result = new BContensText( "" ); 437 439 } 438 440 } … … 784 786 //--------------------------------------------------------------------------- 785 787 DeclareContensClass(BSet, BSetTemporary, BSetExcelReadRange); 786 DefExtOpr(1, BSetExcelReadRange, "Excel.ReadRange", 3, 3, "Real Anything Anything", 787 "(Real ExcelHandler, Anything CornerLT, Anything CornerRB)", 788 DefExtOpr(1, BSetExcelReadRange, "Excel.ReadRange", 3, 4, 789 "Real Anything Anything Set", 790 "(Real ExcelHandler, Anything CornerLT, Anything CornerRB [,Set ColumnTypes])", 788 791 I2("Return the contents of the cells contained given cell's range. " 789 792 "The cell corners delimiting the range can be given as Text or " … … 807 810 // bool status1 = ; 808 811 // bool status2 = ; 812 BSet *ptrArgs = NULL; 813 809 814 if ( TolExcel::getCellCoordinates( _name_, cornerLT, r0, c0 ) && 810 815 TolExcel::getCellCoordinates( _name_, cornerBR, r1, c1 ) ) { … … 812 817 BList* aux = NIL; 813 818 size_t r,c; 819 size_t numColumns = c1 - c0 + 1; 820 if ( NumArgs() > 3 ) { 821 ptrArgs = &Set( Arg( 4 ) ); 822 if ( numColumns == ptrArgs->Card() ) { 823 for ( c = 1; c <= ptrArgs->Card(); c++ ) { 824 BGrammar *grammar = (*ptrArgs)[c]->Grammar(); 825 if ( grammar != GraText() && 826 grammar != GraReal() && 827 grammar != GraDate() ) { 828 Warning( _name_ + ": " + 829 "Invalid type in column type specification, only Real, Date or Text is returned from excel" ); 830 ptrArgs = NULL; 831 break; 832 } 833 } 834 } else { 835 char buffer[256]; 836 snprintf( buffer, 256, "Expecting %d columns (%d,%d)", numColumns, c0, c1 ); 837 Warning( _name_ + ": " + 838 "The number of column's types does not match the number of columns. " + buffer); 839 ptrArgs = NULL; 840 } 841 } 814 842 for( r = r0; r <= r1; r++ ) { 815 843 BList* lsta = NIL; … … 817 845 for( c = c0; c <= c1; c++ ) { 818 846 BSyntaxObject *cellValue = xls->GetCellAnything( _name_, r, c ); 847 // OJO: aqui hay que rellenar con el omitido segun el tipo de columna 819 848 if ( !cellValue ) { 820 cellValue = new BContensText( "" ); 849 cellValue = ptrArgs ? ((*ptrArgs)[c-c0+1])->CopyContens() : 850 new BContensText( "" ); 821 851 } 822 852 LstFastAppend( lsta, auxa, cellValue ); … … 861 891 "direccion de objecto excel invalido") ); 862 892 return NULL; 863 } 893 } 894 // OJO, puede venir NULL 864 895 result = xls->GetCellAnything( _name_, i_row, i_col ); 896 if ( !result ) { 897 result = new BContensText( "" ); 898 } 865 899 } 866 900 }
Note: See TracChangeset
for help on using the changeset viewer.
