In some cases users would like to make selections before doing the conversion, this could be useful in order to:
The difficulty here is two-fold:
So a lot of discussion around this is needed to understand the various requirements and implementation bits. Feedback welcome
I had a desperate need to export specific sheets from many spreadsheets recently and modified unoconv to do my bidding. I'm not suggesting that this is a good approach for specifying the sheet to convert, but it has really helped me out in a pinch. Below is the patch of what I've done (this is against debian wheezy's unoconv):
> self.sheet_name = None
< opts, args = getopt.getopt (args, 'c:Dd:e:f:hi:Llo:np:s:T:t:v',
> opts, args = getopt.getopt (args, 'c:Dd:e:f:hi:Llo:np:s:S:T:t:v',
< 'pipe=', 'port=', 'server=', 'timeout=', 'show', 'stdout',
< 'template', 'verbose', 'version'] )
> 'pipe=', 'port=', 'server=', 'timeout=', 'sheet=', 'show',
> 'stdout', 'template', 'verbose', 'version'] )
> elif opt in ['-S', '--sheet']:
> self.sheet_name = arg
> if op.sheet_name:
> sheets = document.getSheets()
> sheets.moveByName(op.sheet_name, 0)
In case it proves useful to anyone in the interim, I've applied zonaj's changes to a fork of unoconv.
No pull request at present, since --sheet='sheet-name' probably isn't the best solution in the long term. It's been quite helpful, however.
Yes, it's interesting to see how it's done on a per-sheet basis. But I think we need to have a more general --select option that allows you to specify:
It cannot be that hard.
Let me also add, that I prefer a solution that is not limited to spreadsheets. The same is useful for selecting pages or slides during conversions using the same option.
Apart from this generic use-case (i.e. making selections before doing the export), there may be more flexible option by allowing people to write plugins/extensions to unoconv that we can maintain separately. unoconv could allow to run such a plugin/extension between the import and export phase where the user can make manipulations (search-and-replace, content-modifications, selections, disabling/enabling options, formatting, ...)
A hint into that direction is available from #40, and apart from the selection functionality that appeals to most users, I would like to implement this plugin/extension mechanism independently. For this I opened a new ticket #84, which in my opinion is more important than any other existing feature request :-)
I took the @zopa / @zonaj fork and updated it to the current version of master:
@freewil , thanks - it really works) Why you didn't create the pull request?
Based on the discussion above, it doesn't sound like it would be considered merge-worthy.
@dagwieers If i submit the PR, will you merge it?
I have this need. I am not sure if I really understand whether my need is solved by the above. I want a simple unoconv command line to convert ALL slides to some image format to my output directory. The above seems to discuss some possibly useful subparts but unless I am missing it I do not see the solution to what I really need and I that I am sure many others need as well. It is very important to me that it be a cli solution. Is this possible and if so how?
I had the same problem and zonaj's branch was really useful.
Also I made a few improvements (maybe they could be useful for anyone) in my own github repo. I just sent a pull request:
NOTE for Ubuntu/Debian users: I also had a small headache because official (and thereby zonaj's) versions doesn't work "out of the box" in Debian/Ubuntu. It throws a confusing error message saying that couldn't find libre/openoffice (while I have working ubuntu's unoconv version installed). ...This is not real. It is caused because Ubuntu/Debian's default python interpreter is 2.x instead of 3.x. Ubuntu's unoconv changes the script shebang from 'python' to 'python3' to address this.
...so, if you use Debian/Ubuntu, you would need to also change it or invoke the interpreter explicitly by typing 'python3 unoconv ...'.
EDIT: In Debian works fine with Python 2.x. The actual problem in ubuntu was the lack of python-uno package. Debian has both: python-uno and python3-uno, but Ubuntu comes only python3-uno. This is why they changes shebang of its unoconv package.
I make zonaj's changes, result:
# unoconv3 -d spreadsheet -f html --sheet='Físico' 2.xlsx
File "/usr/bin/unoconv3", line 856
sheets.moveByName (op.sheetname, 0)
IndentationError: unindent does not match any outer indentation level