Save ole file as office document

755 Views Asked by At

I have some ole file with ole2 format in legacy system. These are office word or excel & with embed object (e.g. picture) I think. If I rename the file with docx or xlsx externsion, it will say file is corrupted.

Could I extract the ole file with some existing C# library? And save it as word or excel document?

OLEFileStructure PNG

NOTE:

Updates: (Possible solution)

For old style, e.g. xls, doc, it could just rename the ole file to those extension and it works. But some of the file cannot be opened via MS Office, but it open successfully via Libre Office.

For new style, e.g. xlsx, docx. It could extract the Package stream and save as xlsx or docx. file.

1

There are 1 best solutions below

1
On

For old style, e.g. xls, doc, it could just rename the ole file to those extension and it works. But some of the file cannot be opened via MS Office, but it open successfully via Libre Office. So I use the Libre office command line tool to convert it with same format, e.g. soffice --convert-to docx *.docx --outdir ../Converted Then it could be opened via MS Office.

For new style, e.g. xlsx, docx. It could extract the Package stream and save as xlsx or docx. file.