Convert .odt .doc .ods files to .txt files

前端 未结 8 741
忘了有多久
忘了有多久 2021-02-05 09:21

I want to convert all the .odt .doc .xls .pdf files to .txt files.

I want to convert these files to text

8条回答
  •  南旧
    南旧 (楼主)
    2021-02-05 09:33

    It's certainly possible to do this, though there is something strange and impenetrable about the OO project and its documentation that makes things like this hard to research and follow. However, OO has the capability to convert all of those types, not just the OO native ones, and it can do it via two different forms of automatic control.

    These are the two general approaches.

    1. You can start OO and tell it to execute a macro which does this job for you for a given file. You then just have to write the macro and a script to loop over your files. The syntax is something like

      $ oowriter -headless filename macro://dir/Standard.Module1.sMySub

    2. The other thing OO has is a network API. This is based on something called UNO.

      $ oowriter -accept=accept-string

      Notifies  the  OpenOffice.org software that upon the creation of
      "UNO Acceptor Threads", a "UNO Accept String" will be used.
      

    You will need some sort of client library. I think they have one for Python at least. Using this technology a Python program or some other scripting language with an OO client library could drive the program and convert all the files. Since OO reads MSO, it should be able to do all of them.

提交回复
热议问题