for a company wide integration of LibreOffice I need to convert all existing MS Office files (a few thousand) to LiberOffice.
First Problem and a big dealbreaker is the fact that already some slightly wrong formatted files(A few empty lines are formatted as Headers) wont be opened and stall the whole process.
They also wont open manually, only after I opened them in MS Word(Currently im converting only Word files) and removed the formatting of the empty lines will they open in LibreOffice.
Isnt there a way to open the documents without validating and search through Headers, correct them and then open it completely ?
Or will I have to code the correcting process for MS Office with interop ?
I open with the following code, the code is sound and worked before without problems.
Code is C#
Code: Select all
private static XComponent Open(string path, XMultiServiceFactory factory, PropertyValue[] param)
{
var sheetprops = new List<PropertyValue>();
var loader = (XComponentLoader)factory.createInstance("com.sun.star.frame.Desktop");
var url = string.Empty;
if (!path.Contains("private:factory"))
{
if (!File.Exists(path))
throw new FileNotFoundException(path);
url = CorrectUnoPath(path);
}
else
url = path;
sheetprops.Add(FormatOperations.GetHiddenProp());
if(param != null)
foreach(var value in param)
sheetprops.Add(value);
var doc = loader.loadComponentFromURL(url, "_blank", 0, sheetprops.ToArray());
if (doc == null)
throw new ArgumentNullException("Ursache: Document is null");
return doc;
}