diff options
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/odsfile/odsfile.lua')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/odsfile/odsfile.lua | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/lualatex/odsfile/odsfile.lua b/Master/texmf-dist/tex/lualatex/odsfile/odsfile.lua index 8fdf30abee6..a32e370566c 100644 --- a/Master/texmf-dist/tex/lualatex/odsfile/odsfile.lua +++ b/Master/texmf-dist/tex/lualatex/odsfile/odsfile.lua @@ -162,8 +162,15 @@ function tableValues(tbl,x1,y1,x2,y2) return t end +function join(tbl1, tbl2) + for _, x in ipairs(tbl2) do + tbl1[#tbl1+1] = x + end + return tbl1 +end + function getRange(range) - if range == nil then return {nil,nil,nil,nil} end + if range == nil then return {{nil,nil,nil,nil}} end local range = namedRanges[range] or range local r = range:lower() local function getNumber(s) @@ -175,10 +182,12 @@ function getRange(range) end return f end + local ranges = {} for x1,y1,x2,y2 in r:gmatch("(%a*)(%d*):*(%a*)(%d*)") do - return {getNumber(x1),tonumber(y1),getNumber(x2),tonumber(y2)} + ranges[#ranges+1] = {getNumber(x1),tonumber(y1),getNumber(x2),tonumber(y2)} --print(string.format("%s, %s, %s, %s",getNumber(x1),y1,getNumber(x2),y2)) end + return ranges end function table_slice (values,i1,i2) @@ -329,6 +338,12 @@ function updateZip(zipfile, updatefile) print ("Updating an ods file.\n" ..command .."\n Return code: ", os.execute(command)) end +function save(filename, content) + local f = io.open(filename, "w") + f:write(content) + f:close() +end + M.load= load M.loadContent = loadContent M.getTable= getTable @@ -336,6 +351,7 @@ M.getTable0= getTable0 M.getColumnCount= getColumnCount M.loadNameRanges= loadNameRanges M.tableValues= tableValues +M.join = join M.getRange= getRange M.getNumber= getNumber M.table_slice = table_slice @@ -352,5 +368,6 @@ M.findLastRow = findLastRow M.insert = insert -- for updateing the archive. Depends on external zip utility M.updateZip= updateZip +M.save = save return M |