Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion OriginAnyParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2176,7 +2176,12 @@ void OriginAnyParser::getCurveProperties(const string &cvehd, unsigned int cvehd
stmp.str(cvehd.substr(0x4A));
GET_SHORT(stmp, width)
}
int col_index = findColumnByName((int)ispread, name);
unsigned short dataID = 0;
stmp.str(cvehd.substr(0x04));
GET_SHORT(stmp, dataID)
int col_index = dataID > 0 ? findColumnByDatasetIndex((int)ispread, dataID - 1) : -1;
if (col_index == -1)
col_index = findColumnByName((int)ispread, name);
if (col_index != -1) {
spreadSheets[ispread].columns[col_index].name = name;

Expand Down
10 changes: 10 additions & 0 deletions OriginParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,13 @@ int OriginParser::findColumnByName(int spread, const string &name)
}
return -1;
}

int OriginParser::findColumnByDatasetIndex(int spread, unsigned int datasetIndex) const
{
const size_t columnsCount = spreadSheets[spread].columns.size();
for (unsigned int i = 0; i < columnsCount; i++) {
if (spreadSheets[spread].columns[i].index == datasetIndex)
return i;
}
return -1;
}
1 change: 1 addition & 0 deletions OriginParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ORIGIN_EXPORT OriginParser
void convertSpreadToExcel(std::vector<Origin::SpreadSheet>::size_type spread);

int findColumnByName(int spread, const std::string &name);
int findColumnByDatasetIndex(int spread, unsigned int datasetIndex) const;

private:
bool iequals(const std::string &, const std::string &,
Expand Down
2 changes: 1 addition & 1 deletion tests/examples/2folder-with-graphs.opj.out.orig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
opj2dat 3.0.3, Copyright (C) 2008-2024 Stefan Gerlach, 2017 Miquel Garriga
opj2dat 3.0.4, Copyright (C) 2008-2024 Stefan Gerlach, 2017 Miquel Garriga
Project has 4 windows.
Origin project Tree
2folder-with-graphs 2022-01-15 17:31:39
Expand Down
Binary file added tests/examples/column-dataid-collision.opj
Binary file not shown.
4 changes: 4 additions & 0 deletions tests/examples/column-dataid-collision.opj.1.dat.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ABCDEFGHIJK; ABCDEFGHIJK;
1; 2;
2; 4;
3; 5;
22 changes: 22 additions & 0 deletions tests/examples/column-dataid-collision.opj.out.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
opj2dat 3.0.4, Copyright (C) 2008-2024 Stefan Gerlach, 2017 Miquel Garriga
Project has 1 windows.
Origin project Tree
column-dataid-collision 2006-04-29 17:26:12
Parsing status = 1
OPJ PROJECT "examples/column-dataid-collision.opj" VERSION = 9.75
number of datasets = 2
number of spreadsheets = 1
number of matrices = 0
number of excels = 0
number of functions = 0
number of graphs = 0
number of notes = 0
Spreadsheet 1
Name: Data1
Label:
Columns: 2
Column 1 : ABCDEFGHIJK / type : 0, rows : 3
Column 2 : ABCDEFGHIJK / type : 1, rows : 3
saved to examples/column-dataid-collision.opj.1.dat
ABCDEFGHIJKABCDEFGHIJK
Data:
2 changes: 1 addition & 1 deletion tests/examples/crash.opj.out.orig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
opj2dat 3.0.3, Copyright (C) 2008-2024 Stefan Gerlach, 2017 Miquel Garriga
opj2dat 3.0.4, Copyright (C) 2008-2024 Stefan Gerlach, 2017 Miquel Garriga
Project has 1 windows.
Origin project Tree
bar 2013-01-31 10:11:35
Expand Down
2 changes: 1 addition & 1 deletion tests/examples/data+graph-7.0.opj.out.orig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
opj2dat 3.0.3, Copyright (C) 2008-2024 Stefan Gerlach, 2017 Miquel Garriga
opj2dat 3.0.4, Copyright (C) 2008-2024 Stefan Gerlach, 2017 Miquel Garriga
Project has 2 windows.
Origin project Tree
data+graph-7.0 2006-04-29 17:26:12
Expand Down
2 changes: 1 addition & 1 deletion tests/examples/reciprocal-scale-x.opj.out.orig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
opj2dat 3.0.3, Copyright (C) 2008-2024 Stefan Gerlach, 2017 Miquel Garriga
opj2dat 3.0.4, Copyright (C) 2008-2024 Stefan Gerlach, 2017 Miquel Garriga
Project has 2 windows.
Origin project Tree
reciprocal-scale-x 2024-11-07 21:34:57
Expand Down