I have managed to solve the problem by setting the UNO_PATH
environment variable before starting the soffice.exe
server:
using static System.Environment;
var unoPath = @"C:Program FilesLibreOffice 5program"
// when running 32-bit LibreOffice on a 64-bit system, the path will be in Program Files (x86)
// var unoPath = @"C:Program Files (x86)LibreOffice 5program"
SetEnvironmentVariable("UNO_PATH", unoPath, EnvironmentVariableTarget.Process);
SetEnvironmentVariable("PATH", GetEnvironmentVariable("PATH") + @";" + unoPath, EnvironmentVariableTarget.Process);
This was required because LibreOffice 5's program directory does not have "URE" subdirectory anymore (previous versions did) which is required for UNO layer.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…