64 lines
1.4 KiB
Plaintext
64 lines
1.4 KiB
Plaintext
type XlsxSheetDataRow = class
|
|
public
|
|
function Create(row: Row);
|
|
function Operator[](index: integer): XlsxSheetDataCol;
|
|
function Cols(index: integer): XlsxSheetDataCol;
|
|
function Data(): Row;
|
|
function Serialize();
|
|
|
|
public
|
|
row_: Row;
|
|
cols_: array of XlsxSheetDataCol;
|
|
end;
|
|
|
|
|
|
function XlsxSheetDataRow.Create(row: Row);
|
|
begin
|
|
row_ := row;
|
|
cols_ := array();
|
|
cs := row.Cs();
|
|
for i:=0 to length(cs)-1 do
|
|
begin
|
|
r := cs[i].R;
|
|
cell_name := SplitCellName(r);
|
|
index := ColumnNameToNumber(cell_name[1])[1];
|
|
cols_[index] := cs[i];
|
|
end
|
|
// println("cols_ = {}", cols_);
|
|
end;
|
|
|
|
function Operator XlsxSheetDataRow.[](index: integer): XlsxSheetDataCol;
|
|
begin
|
|
if ifnil(cols_[index]) and tslassigning then
|
|
begin
|
|
col := new C(row_, "", "c");
|
|
cols_[index] := col;
|
|
pos := -1;
|
|
for k,_ in cols_ do
|
|
if pos < k and k < index then pos := k;
|
|
pos = -1 ? row_.AppendChild(col) : row_.InsertAfter(col, cols_[pos]);
|
|
end
|
|
return cols_[index];
|
|
end;
|
|
|
|
function XlsxSheetDataRow.Cols(index: integer): XlsxSheetDataCol;
|
|
begin
|
|
return self[index];
|
|
end;
|
|
|
|
function XlsxSheetDataRow.Data(): Row;
|
|
begin
|
|
return row_;
|
|
end;
|
|
|
|
function XlsxSheetDataRow.Serialize();
|
|
begin
|
|
for k,c in cols_ do
|
|
begin
|
|
c.R := CoordinatesToCellName(k, row_.R)[1];
|
|
c.Serialize();
|
|
// println("c.R = {}, row.R = {}", c.R, row_.R);
|
|
end
|
|
row_.Serialize();
|
|
end;
|