How to start soffice using c#

Hi All,

I am converting my office files to pdf using Libreoffice and on my local machine it works using the version 6.0.6. I’m pushing the current c# code to a test server and have configured the latest version of Libreoffice 6.1.4

The C# code is just a process which has arguments and calls the soffice.exe with these args
as shown below, but I can’t seem to start the process using the code now and I tested the arguments manually which seemed to work perfectly, Do I need admin rights for soffice:

           proc.StartInfo.FileName = dictionary["PATH_TO_LIBREOFFICE"];


            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.RedirectStandardError = true;
            proc.StartInfo.UseShellExecute = false;

            proc.StartInfo.Arguments = arguments;
            proc.StartInfo.CreateNoWindow = true;
            proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

            proc.ErrorDataReceived += (sender, args) => error.Append(args.Data);
            proc.OutputDataReceived += (sender, args) => output.Append(args.Data);

            proc.Start();

            proc.BeginOutputReadLine();
            proc.BeginErrorReadLine();
            proc.WaitForExit();

@BinoyCherian: this and its apparent duplicate are the first that you posted with the wrong community wiki option - why? (I don’t even ask why posting duplications - possibly there’s a substantial difference there, so that one of these answered doesn’t answer the other automatically?)

The data you presented here simply doesn’t tell anything useful. It’s ~same if I’d wrote:

“I try to run soffice like using this command: %MYPATHVAR% %MYARGVAR1% %MYARGVAR2% %MYARGVAR3%, but it doesn’t want. I won’t tell you even what error I get in return ;-P”

Hey @Mike2, thank you, You are right, this is a doppleganger, I’m gonna remove the question eod :), I didn’t know how or when I selected the wiki option. But I could get the lo soffice working on my local(the latest stable and the 6.1.4). :slight_smile: