diff options
author | Karl Berry <karl@freefriends.org> | 2015-09-23 23:36:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-09-23 23:36:30 +0000 |
commit | dc9643d7d269a0d9153ee8dc2983009c9c0ddbc8 (patch) | |
tree | 8ec9fdefcbc812373d416cda5ab30c7831163255 /Master/texmf-dist/tex/lualatex/odsfile/odsfile.sty | |
parent | 9e8df486903c5e9c134230909b411a1a05cb782d (diff) |
odsfile (23sep15)
git-svn-id: svn://tug.org/texlive/trunk@38449 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/odsfile/odsfile.sty')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/odsfile/odsfile.sty | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/lualatex/odsfile/odsfile.sty b/Master/texmf-dist/tex/lualatex/odsfile/odsfile.sty index 57a2be71952..97f9e0d9c61 100644 --- a/Master/texmf-dist/tex/lualatex/odsfile/odsfile.sty +++ b/Master/texmf-dist/tex/lualatex/odsfile/odsfile.sty @@ -3,14 +3,15 @@ %keyval keys -\define@key{includespread}{file}{\loadodsfile{#1}} -\define@key{includespread}{sheet}{\luaexec{sheetname = "\luatexluaescapestring{#1}"}} +\define@key{includespread}{file}{\loadodsfile{#1}}% +\define@key{includespread}{sheet}{\luaexec{sheetname = "\luatexluaescapestring{#1}"}}% \define@key{includespread}{range}{\luaexec{% local x1,y1,x2,y2 = odsreader.getRange("\luatexluaescapestring{#1}")% range = {x1,y1,x2,y2}% }} \define@key{includespread}{template}{\luaexec{currenttemplate="\luatexluaescapestring{#1}"}}% \define@key{includespread}{rowtemplate}{\luaexec{rowtemplate="\luatexluaescapestring{\unexpanded{#1}}"}}% +\define@key{includespread}{multicoltemplate}{\luaexec{multicoltpl="\luatexluaescapestring{\unexpanded{#1}}"}}% \define@choicekey*+{includespread}{rowseparator}[\val\nr]{tableline,hline,newline}[tableline]% {% @@ -27,10 +28,10 @@ rowseparator=[[\\n]] \luaexec{rowseparator="\luatexluaescapestring{#1}"} } \define@key{includespread}{columnbreak}{% - \luaexec{columnbreak="\luatexluaescapestring{\unexpanded{#1}}{}"} + \luaexec{columnbreak="\luatexluaescapestring{\unexpanded{#1}}{}"}% } \define@key{includespread}{coltypes}{% - \luaexec{coltypes="\luatexluaescapestring{\unexpanded{#1}}"} + \luaexec{coltypes="\luatexluaescapestring{\unexpanded{#1}}"}% } \define@choicekey*+{includespread}{columns}[\val\nr]{head,top,none}{% \ifcase\nr\relax% @@ -64,7 +65,8 @@ row = {} body = nil odsfilename = "" currenttemplate = nil -rowtemplate=nil +rowtemplate = nil +multicoltpl = "\\multicolumn{-{count}}{l}{-{value}}" \end{luacode*} \newcommand\loadodsfile[2][]{% @@ -78,7 +80,7 @@ rowtemplate=nil \newcommand\tabletemplate[2]{% \luaexec{% - templates["#1"]="\luatexluaescapestring{\unexpanded{#2}}" + templates["#1"]="\luatexluaescapestring{\unexpanded{#2}}"% } } @@ -110,11 +112,17 @@ rowtemplate=nil local t={} local i = 1 for _,column in pairs(row) do + local attr = column.attr or {} local value, br = concatParagraphs(column.value) value = value or "" + local x = attr["table:number-columns-spanned"] or "1" + x = tonumber(x) + if x > 1 then + value = odsreader.interp(multicoltpl, {value = value, count = x}) + end table.insert(t,value) headings[i] = br - i = i + 1 + i = i + x end return t, headings end @@ -177,10 +185,12 @@ rowtemplate=nil table.insert(content,odsreader.interp(rowtemplate,rowValues(row))) end content = table.concat(content,rowseparator) - tex.sprint(odsreader.interp(templates[currenttemplate],{content=content})) + local result = odsreader.interp(templates[currenttemplate],{content=content,coltypes=coltypes,colheading=colheading,rowsep=rowseparator}) + print(result) + tex.sprint(result) end - } -} + }% +}% \tabletemplate{empty}{-{content}} |