Unzip a .odt file, it contains content.xml file. A comment looks like this:
<office:annotation office:name="__Fieldmark__1_514712390">
<dc:creator>John Smith</dc:creator>
<dc:date>2014-05-29T14:38:39.846905891</dc:date>
<text:list text:style-name="">
<text:list-item>
<text:p text:style-name="P2">
<text:span text:style-name="T1">A comment text.</text:span>
</text:p>
</text:list-item>
</text:list>
</office:annotation>
Now all you need to do is replace all <dc:date>2014-05-29T14:38:39.846905891</dc:date>
with a dummy date, e.g 2000-01-01T12:00:00.0
and save it back to original .odt file. Or why not use the date when document was created (in meta.xml): <meta:creation-date>2014-05-29T14:38:30.386644381</meta:creation-date>
The following python script does it for you and renames the file as name-clean.odt:
#!/usr/bin/python
import glob, re, os, sys, zipfile
for pattern in sys.argv[1:]:
for filepath in glob.glob(pattern):
dirname, basename = os.path.split(filepath)
root, ext = os.path.splitext(basename)
newname = '%s-clean%s' % (root, ext)
outpath = os.path.join(dirname, newname)
zin = zipfile.ZipFile (filepath, 'r')
zout = zipfile.ZipFile (outpath, 'w')
for item in zin.infolist():
if item.filename == 'mimetype':
zout.writestr(item, zin.read(item.filename))
for item in zin.infolist():
if item.filename == 'meta.xml':
data = zin.read(item.filename)
# Find the document creation timestamp.
timestamp = re.search(r'<meta:creation-date>([^<]+)</meta:creation-date>', data).group(1)
for item in zin.infolist():
if item.filename == 'content.xml':
data = zin.read(item.filename)
# Replace all occurrences of date in <dc:date>
data = re.sub('<dc:date>[^<]+</dc:date>', '<dc:date>%s</dc:date>' % timestamp, data)
zout.writestr(item, data)
elif item.filename != 'mimetype':
zout.writestr(item, zin.read(item.filename))
zout.close()
zin.close()