After looking at the spreadsheet->latex converter "ssconvert", I made an external inset for gnumeric spreadsheets. Turns out that the converter works for openoffice & excel too. Tested with a gnumeric file, an excel file, and a oocalc file, including page breaking in the middle of a spreadsheet.
Note that gnumeric is necessary even for the excel and openoffice spreadsheets, because ssconvert is distributed with gnumeric only. A recompile is necessary, this only because ssconvert requires several latex packages that wasn't in the feature list already. Rotation/scaling is not supported, I couldn't get that working. The patch may work for 1.5.x - I have not tested that. But I guess that is a format change anyway - a LyX file with a embedded spreadsheet won't work with an older LyX that don't have this external template. A demo pdf: http://www.aitel.hist.no/~helgehaf/extgnumeric.pdf Patches attached, Helge Hafting
Index: configure.py =================================================================== --- configure.py (revisjon 21516) +++ configure.py (arbeidskopi) @@ -273,6 +273,11 @@ \Format text3 txt "Plain text (ps2ascii)" "" "" "%%" "document" \Format text4 txt "Plain text (catdvi)" "" "" "%%" "document" \Format textparagraph txt "Plain Text, Join Lines" "" "" "%%" "document"''' ]) + #Spreadsheets using ssconvert from gnumeric + checkViewer('gnumeric spreadsheet software', ['gnumeric'], + rc_entry = [r'''\Format gnumeric gnumeric "Gnumeric spreadsheet" "" "" "%%" "document" +\Format excel xls "Excel spreadsheet" "" "" "%%" "document" +\Format oocalc ods "OpenOffice spreadsheet" "" "" "%%" "document"''']) # #checkProg('a Postscript interpreter', ['gs'], # rc_entry = [ r'\ps_command "%%"' ]) @@ -453,6 +458,14 @@ '']) # # + + # gnumeric/xls/ods to tex + checkProg('a spreadsheet -> latex converter', ['ssconvert'], + rc_entry = [ r'''\converter gnumeric latex "ssconvert --export-type=Gnumeric_html:latex $$i $$o" "" +\converter ods latex "ssconvert --export-type=Gnumeric_html:latex $$i $$o" "" +\converter xls latex "ssconvert --export-type=Gnumeric_html:latex $$i $$o" ""''', + '']) + path, lilypond = checkProg('a LilyPond -> EPS/PDF/PNG converter', ['lilypond']) if (lilypond != ''): version_string = cmdOutput("lilypond --version")
Index: external_templates =================================================================== --- external_templates (revisjon 21516) +++ external_templates (arbeidskopi) @@ -2,7 +2,7 @@ # file external_templates # This file is part of LyX, the document processor. # Licence details can be found in the file COPYING. -# +# # author Asger Alstrup Nielsen # author Angus Leeming # author Johnathan Burchill @@ -33,6 +33,45 @@ \IfFileExists{#1}{\input{#1}}{\warnNotFound{#1}}} PreambleDefEnd +Template GnumericSpreadsheet + GuiName "Spreadsheet" + HelpText + A spreadsheet made with gnumeric, openoffice or excel. + It imports as a long table, so any length + is ok. Excessive width could be a problem. + The gnumeric software is necessary for conversion, + both for gnumeric and excel files. + HelpTextEnd + InputFormat "gnumeric" + FileFilter "*.{gnumeric,ods,xls}" + AutomaticProduction true + Format LaTeX + Product "\\def\\inputGnumericTable{}\\input{$$AbsOrRelPathMaster$$Basename.tex}" + UpdateFormat latex + UpdateResult "$$AbsPath$$Basename.tex" + Requirement "color" + Requirement "array" + Requirement "longtable" + Requirement "calc" + Requirement "multirow" + Requirement "hhline" + Requirement "ifthen" + ReferencedFile latex "$$AbsOrRelPathMaster$$Basename.tex" + FormatEnd + Format PDFLaTeX + Product "\\def\\inputGnumericTable{}\\input{$$AbsOrRelPathMaster$$Basename.tex}" + UpdateFormat latex + UpdateResult "$$AbsPath$$Basename.tex" + Requirement "color" + Requirement "array" + Requirement "longtable" + Requirement "calc" + Requirement "multirow" + Requirement "hhline" + Requirement "ifthen" + ReferencedFile latex "$$AbsOrRelPathMaster$$Basename.tex" + FormatEnd +TemplateEnd Template RasterImage # By default, InsetExternal is displayed as a grey button