Mass convert MS Office files to LibreOffice ODF

The Application Programming Interface and the OASIS Open Document Format

Mass convert MS Office files to LibreOffice ODF

Postby someware » Fri Nov 21, 2014 1:05 pm

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.
LibreOffice, Version: 4.3.3.2, Win 8.1 proffessional 64 bit
someware
 
Posts: 19
Joined: Wed Feb 05, 2014 6:29 pm

Re: Mass convert MS Office files to LibreOffice ODF

Postby someware » Tue Nov 25, 2014 10:52 am

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.
LibreOffice, Version: 4.3.3.2, Win 8.1 proffessional 64 bit
someware
 
Posts: 19
Joined: Wed Feb 05, 2014 6:29 pm

Re: Mass convert MS Office files to LibreOffice ODF

Postby Villeroy » Tue Nov 25, 2014 11:05 am

Enable some 32-bit Java in Tools>Options>Java settings and call menu:File>Wizzard>Document Converter...
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28679
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest

cron