Tell me how to be)

Background:

У друга на работе уволился админ и на компе, буха, юрика и самого директора, изменил пользователя на Х%Й Булыжников или Пися Камушкин - не суть) Но обнаружили это через неделю или две, когда открыли документы doc, odt,xsl и прочие офисные, нажали файл - Свойства и там увидели сие чудо) а файлы они эти куда-то шлют и там через эту процедуру, даты сверяют в случае чего,) 

How can such office files become overplayed (change or remove the author)?)

Hands on for a long time (create a new dock, throw everything into it and save - there are hundreds of documents) of course, now the User is normal, but some documents are left with Paschal)))

Tell me how under linux or windows you can automatically change.

I think that the script is possible, but I do not understand how to work with api or the libreOffice itself from the console

Thank...

ps as it turned out - the admin was very offended ... and then they realized that they were wrong, but it was too late)

Convert to another format, in the hope of changing the author just as senselessly

 libreoffice -env:UserInstallation=file:///home/firefedot/.config/libreoffice-alt --headless --convert-to odt *.doc 

As a result, the same author of the document creation and the same authors of the changes remained.

  • Under Windows take js, read Excel. Application. new ActiveXObject('Excel.Application') . new ActiveXObject('Excel.Application') . You will need the function Load, Save and Quit. - nick_n_a
  • yeah, thank you .. it remains to find the Windows .. but I understand ... but it is necessary that the MS Office be standing? - Sober
  • Excel.Application is in the office package, an office must be installed on the machine that can read your excel. - nick_n_a
  • Oh, I get it ... Thank you - Sober

2 answers 2

Thanks @Qwertiy for the hint.

In general, so far this option is found. First we cast all the necessary files to the type odt, thus

 libreoffice -env:UserInstallation=file:///home/firefedot/.config/libreoffice-alt --headless --convert-to odt *.doc 

Then you can script, and you can with your hands, we do so. Unpack our ODT file in a folder

 unzip file.odt -d folder 

After that we search and replace the necessary / unnecessary author.

  grep NONAMES meta.xml --color # Или если не знаем имени, то grep creator meta.xml --color 

And we will see what we need, it will be highlighted)

Replace all you need

 sed -i 's/NONAMES/MyName/g' meta.xml 

Then, we give the final steps. We pack everything back, in two stages, for the correct structure of the new file

one:

 cd folder zip -0 -X file.odt mimetype 

2:

 zip -r file.odt * -x mimetype 

After this, the file is opened without error and if you open the File-Properties menu, we will see the author who contributed.

It remains to check how this all works with file names containing spaces.

ps if @Qwertiy objects, then I can give it all back.

    The .dt file is a zip archive. It is necessary to unpack it as a zip-archive, find where in there is the user name, change and pack back. Similar to docx (but not doc).

    PS: I did it with vsdx.

    • And how to unpack it? Something until I find that he will understand. Renaming to another extension did not work naturally. Any package may need? - Sober
    • one
      @ Sober, any archiver who can zip. - Qwertiy
    • Exactly, something drove ... unzip could ... and back, the same? I specify all the folders and odt? - Sober
    • one
      @ Sober, yes. Only with compression methods are not wise. And you need to pack files in a folder, not a folder. - Qwertiy
    • Yes, I collected back zip -0 file.odt * and he collected it, when opening it, it swears, That it is beaten, restores. but the author does not change for the new. although the old and disappears. In general, it seems to be normal. But an error when opening on a yarn .. maybe you need some kind of compression degree? I did without her bye .. - Sober