How to start soffice using c# [closed]

asked 2019-02-04 14:34:00 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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();
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by BinoyCherian
close date 2019-02-05 09:53:37.239264

Comments

@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"

Mike Kaganski gravatar imageMike Kaganski ( 2019-02-04 16:37:50 +0100 )edit

Hey @Mike, 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). :)

BinoyCherian gravatar imageBinoyCherian ( 2019-02-05 09:27:11 +0100 )edit