diff --git a/experiment_data/analysis_state/617-new.xlsx b/experiment_data/analysis_state/617-new.xlsx new file mode 100644 index 0000000..dd315c9 Binary files /dev/null and b/experiment_data/analysis_state/617-new.xlsx differ diff --git a/experiment_data/analysis_state/6172-new.xlsx b/experiment_data/analysis_state/6172-new.xlsx new file mode 100644 index 0000000..1416640 Binary files /dev/null and b/experiment_data/analysis_state/6172-new.xlsx differ diff --git a/experiment_data/analysis_state/~$617-new.xlsx b/experiment_data/analysis_state/~$617-new.xlsx new file mode 100644 index 0000000..d4a5841 Binary files /dev/null and b/experiment_data/analysis_state/~$617-new.xlsx differ diff --git a/experiment_data/analysis_state/~$6172-new.xlsx b/experiment_data/analysis_state/~$6172-new.xlsx new file mode 100644 index 0000000..d4a5841 Binary files /dev/null and b/experiment_data/analysis_state/~$6172-new.xlsx differ diff --git a/src/data/xlsxhandler.cpp b/src/data/xlsxhandler.cpp index 80d5616..ff6baa1 100644 --- a/src/data/xlsxhandler.cpp +++ b/src/data/xlsxhandler.cpp @@ -44,7 +44,7 @@ int XlsxHandler::readFile(const QString filePath, Global::CurveFileData &cfd) _currentFilePath = filePath; -// cfd.fileName = fileInfo.fileName(); + // cfd.fileName = fileInfo.fileName(); cfd.filePath = filePath; QXlsx::Document xlsx(filePath); @@ -307,6 +307,7 @@ void XlsxHandler:: xlsxFileAppendAnalysisOperation(const QString filePath) logde << "current sheet is empty."; return; } + int index = sheet->dimension().lastRow(); logde<<"lastRow:"< edVtr = + QVector edVtr = phaseVtr.at(i).dataVtr; - if(!phaseVtr.at(i).smoothDataVtr.empty()){ - edVtr = phaseVtr.at(i).smoothDataVtr; - } + if(!phaseVtr.at(i).smoothDataVtr.empty()){ + edVtr = phaseVtr.at(i).smoothDataVtr; + } // phase data size. dataSizeRow = row; @@ -655,6 +656,9 @@ void XlsxHandler::writeXlsxFile(const QString filePath) QVector& phaseVtr = Global::_curveFileDataVtr.first().phaseTotalVtr; + writeSmoothnessFile(filePath); + +#if 0 if(phaseVtr.first().smoothDataVtr.empty()){ logde<<"xlsx file data smooth vtr is empty."; xlsxFileAppendAnalysisOperation(filePath); @@ -662,4 +666,38 @@ void XlsxHandler::writeXlsxFile(const QString filePath) logde<<"xlsx file data smooth vtr is not empty."; writeSmoothnessFile(filePath); } +#endif +} + +int XlsxHandler::deleteInvalidRow(QXlsx::Document *doc) +{ + QXlsx::Worksheet *sheet = doc->currentWorksheet(); + if(!sheet) + { + logde << "current sheet is empty."; + return 0; + } + + int lastRow = doc->dimension().lastRow(); + logde<<"lastRow:"<= startRow; --row) { + QString cellValue = sheet->read(row, 0).toString(); + if (cellValue.isEmpty() + || cellValue == ConAnalysisOperationCount + || cellValue == AnaOpRecorder::NumericalLabelStr + || cellValue == AnaOpRecorder::StartPointStr + || cellValue == AnaOpRecorder::StopPointStr + || cellValue == AnaOpRecorder::PeakSynthesisAnalysisStr + || cellValue == AnaOpRecorder::GlassTransitionStr + || cellValue == AnaOpRecorder::OnsetTemperaturePointStr + || cellValue == AnaOpRecorder::EndsetTemperaturePointStr + ) { + qDebug() << "Row" << row << "is empty or contains specified string. Deleting row."; +// sheet->deleteRows(row, 1); // 删除当前行 +// sheet->deleteRow(row); + } + } } diff --git a/src/data/xlsxhandler.h b/src/data/xlsxhandler.h index 2440b9d..0c992ab 100644 --- a/src/data/xlsxhandler.h +++ b/src/data/xlsxhandler.h @@ -32,6 +32,9 @@ namespace XlsxHandler { void writeAnalysisOperationDetail(QXlsx::Document*doc,const int row); + // discard + int deleteInvalidRow(QXlsx::Document*doc); + extern QString _currentFilePath; const QString ConUnitMg = "mg"; diff --git a/src/ui/centralwidget.cpp b/src/ui/centralwidget.cpp index a8c36e9..3896737 100644 --- a/src/ui/centralwidget.cpp +++ b/src/ui/centralwidget.cpp @@ -574,14 +574,14 @@ void CentralWidget::uiLoadXlsxFileData() #if 1 // Load xlsx file data. + QVector allDataVtr; for(Global::CurveFileData& cfd:Global::_curveFileDataVtr){ for(int i = 0;i < cfd.phaseTotalVtr.size();i++){ Global::PhaseTotalInfo& pti = cfd.phaseTotalVtr[i]; - PointCalculate::setAnalysisData(pti.dataVtr); + allDataVtr.append(pti.dataVtr); // Load data. - QVector dataVtr; QVector tVtr,xVtr, yVtr; int index = 0; for (Global::ExperimentData &ed : pti.dataVtr) @@ -624,6 +624,8 @@ void CentralWidget::uiLoadXlsxFileData() pti.curve = _currentCurve; } + PointCalculate::setAnalysisData(allDataVtr); + // Add analysis operation data. if(cfd.analysisOperationVtr.size() > 0){ for(AnaOpRecorder::AnalysisOperation& ao