mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Adding clarification about the order of arguments
Cell reference arguments are column, row whereas vector arguments are row, column Just a little more explanation to avoid confusion (as the arguments are reversed for each of the functions which we access on the same line.
This commit is contained in:
parent
213c250751
commit
e5da1f41cb
|
@ -174,9 +174,12 @@ int main()
|
|||
for (int fIn = 0; fIn < wholeWorksheet.at(fOut).size(); fIn++)
|
||||
{
|
||||
//Take notice of the difference between accessing the vector and accessing the work sheet
|
||||
//As you may already know Excel spread sheets start at row 1 and column 1 (not row 0 and column 0 like you would expect from a C++ vectors
|
||||
//In short the cell reference starts at column 1 row 1 (column first in the cell_reference argument) and the reference to the vector starts at row 0 and column 0 (row first in the vector argument)
|
||||
//As you may already know Excel spread sheets start at row 1 and column 1 (not row 0 and column 0 like you would expect from a C++ vector)
|
||||
//In short the xlnt cell reference starts at column 1 row 1 (hence the + 1s below) and the vector reference starts at row 0 and column 0
|
||||
wsOut.cell(xlnt::cell_reference(fIn + 1, fOut + 1)).value(wholeWorksheet.at(fOut).at(fIn));
|
||||
//Further clarification to avoid confusion
|
||||
//Cell reference arguments are (column number, row number); e.g. cell_reference(fIn + 1, fOut + 1)
|
||||
//Vector arguments are (row number, column number); e.g. wholeWorksheet.at(fOut).at(fIn)
|
||||
}
|
||||
}
|
||||
std::clog << "Finished writing spread sheet" << std::endl;
|
||||
|
|
Loading…
Reference in New Issue
Block a user