Open tomasr78 opened 10 months ago
Context seems to be in https://help.libreoffice.org/latest/en-US/text/shared/guide/convertfilters.html. It says the command should look like soffice --convert-to OutputFileExtension[:OutputFilterName[:OutputFilterParams[,param]]] [--outdir output_dir]
, and it includes examples like
--convert-to "html:XHTML Writer File:UTF8" *.doc
--convert-to "txt:Text (encoded):UTF8" *.doc
It's worth noting that the entire argument to --convert-to
is wrapped in double quotes in both examples, not just the filter. You seem to have placed the double quotes in wrong places.
(Text - txt - csv (StarCalc)
is also mentioned in that page as the filter name used in the APIs for Text CSV
.)
@tomasr78
var command = @"C:\Program Files\LibreOffice\program\soffice.exe"; var args = new[]
{
"--convert-to", "\"csv:Text - txt - csv (StarCalc):44,34,76,1,-1\"",
"C:\\test.xlsx",
"--outdir",
"C:\\_temp\\"
};
var result = Command.Run(command, args); //runs the command
result.Wait();
cmd /c ""C:\Program Files\LibreOffice\program\soffice.exe" --convert-to csv:"Text - txt - csv (StarCalc)":44,34,76,1,-1 C:\test.xlsx --outdir C:\_temp\"
as in this thread, I think it'll also fail.
I need to execute an obscure LibreOffice command line from C#. It works fine from the command line, but it always fails when using Medallion.Shell with the parameter '--convert-to' and value 'csv:"Text - txt - csv (StarCalc)":44,34,76,1,-1'.
"C:\Program Files\LibreOffice\program\soffice.exe" --convert-to csv:"Text - txt - csv (StarCalc)":44,34,76,1,-1 C:\test.xlsx --outdir C:\_temp\
Medallion.Shell code is below but failing.
If I remove
:"Text - txt - csv (StarCalc)":44,34,76,1,-1
it works, but I need those parameters.