Page 1 of 1

Mass convert MS Office files to LibreOffice ODF

PostPosted: Fri Nov 21, 2014 1:05 pm
by someware
Hello everyone,

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   Expand viewCollapse view
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;
        }


Best Regards and thanks for any help in advance.

Re: Mass convert MS Office files to LibreOffice ODF

PostPosted: Tue Nov 25, 2014 10:52 am
by someware
If there is anything unclear please dont hesitate to ask.
When I speak of wrong formated Header I mean Headlines, just to be clear.

Best Regards.

Re: Mass convert MS Office files to LibreOffice ODF

PostPosted: Tue Nov 25, 2014 11:05 am
by Villeroy
Enable some 32-bit Java in Tools>Options>Java settings and call menu:File>Wizzard>Document Converter...