Changeset 3a849c8 in tol
- Timestamp:
- Mar 20, 2011, 3:21:00 PM (16 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- fe52ab1
- Parents:
- 51de3f7
- File:
-
- 1 edited
-
tol/contrib/excel/tolExcel.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/contrib/excel/tolExcel.cpp
r51de3f7 r3a849c8 346 346 BasicExcel *m_ptrXLS; 347 347 XLSFormatManager *m_ptrFmtMgr; 348 CellFormat *m_ptrCellFmt; 348 349 BasicExcelWorksheet *m_ptrActiveWS; 349 350 }; … … 445 446 m_ptrXLS(NULL), 446 447 m_ptrFmtMgr(NULL), 448 m_ptrCellFmt(NULL), 447 449 m_ptrActiveWS(NULL) 448 450 { 449 m_ptrXLS = new BasicExcel; 450 m_ptrActiveWS = m_ptrXLS->AddWorksheet( ); 451 m_isOpen = false; 451 this->m_ptrXLS = new BasicExcel; 452 this->m_ptrActiveWS = this->m_ptrXLS->AddWorksheet( ); 453 this->m_ptrFmtMgr = new XLSFormatManager( *(this->m_ptrXLS) ); 454 this->m_ptrCellFmt = new CellFormat( *(this->m_ptrFmtMgr) ); 455 this->m_isOpen = false; 452 456 } 453 457 … … 458 462 m_ptrActiveWS(NULL) 459 463 { 460 m_ptrXLS = new BasicExcel;461 if ( !( m_isOpen =m_ptrXLS->Load( path ) ) ) {464 this->m_ptrXLS = new BasicExcel; 465 if ( !( this->m_isOpen = this->m_ptrXLS->Load( path ) ) ) { 462 466 delete m_ptrXLS; 463 m_ptrXLS = NULL;464 } else { 465 m_ptrActiveWS =m_ptrXLS->GetWorksheet( 0 );467 this->m_ptrXLS = NULL; 468 } else { 469 this->m_ptrActiveWS = this->m_ptrXLS->GetWorksheet( 0 ); 466 470 } 467 471 if ( m_ptrXLS ) { 468 m_ptrFmtMgr = new XLSFormatManager( *m_ptrXLS ); 472 this->m_ptrFmtMgr = new XLSFormatManager( *(this->m_ptrXLS) ); 473 this->m_ptrCellFmt = new CellFormat( *(this->m_ptrFmtMgr) ); 469 474 } 470 475 m_ptrActiveWS = NULL; … … 473 478 TolExcel::~TolExcel() 474 479 { 475 if ( m_ptrFmtMgr ) { 476 delete m_ptrFmtMgr; 477 m_ptrFmtMgr = NULL; 478 } 479 if ( m_ptrXLS ) { 480 delete m_ptrXLS; 481 m_ptrXLS = NULL; 482 } 483 m_isOpen = false; 484 m_ptrXLS = NULL; 480 if ( this->m_ptrCellFmt ) { 481 delete this->m_ptrCellFmt; 482 this->m_ptrCellFmt = NULL; 483 } 484 if ( this->m_ptrFmtMgr ) { 485 delete this->m_ptrFmtMgr; 486 this->m_ptrFmtMgr = NULL; 487 } 488 if ( this->m_ptrXLS ) { 489 delete this->m_ptrXLS; 490 this->m_ptrXLS = NULL; 491 } 492 this->m_isOpen = false; 485 493 } 486 494 … … 498 506 } else if ( value->Grammar() == GraDate() ) { 499 507 BDate &date = Date( value ); 508 //XLSFormatManager fmt_mgr(*m_ptrXLS); 509 //CellFormat fmt(fmt_mgr); 500 510 int serialDate = TolExcel::DMYToExcelSerialDate( date.Day(), 501 511 date.Month(), 502 512 date.Year() ); 503 cell->SetDouble( double( serialDate ) ); 513 this->m_ptrCellFmt->set_format_string( "DD/MM/YYYY" ); 514 //fmt.set_format_string( "DD/MM/YY" ); 515 BDateFormat dateFormat( "%d/%m/%y" ); 516 BText txt( dateFormat.DateToText( date ) ); 517 cell->Set( txt.String() ); 518 //cell->SetFormat( fmt ); 519 cell->SetFormat( *(this->m_ptrCellFmt) ); 520 //cell->SetDouble( double( serialDate ) ); 521 //cell->SetDouble( 25780 ); 522 //cell->Set( "31/07/70" ); 504 523 } else if ( value->Grammar() == GraText() ) { 505 524 BText &txt = Text( value );
Note: See TracChangeset
for help on using the changeset viewer.
