• # faut opérer

    Posté par . En réponse au message Diaporama illisible sur LibreOffice 7.04. Évalué à 1.

    Quand ce problème m'arrive (sur du doc mais le principe est le même), j'extrait le fichier content.xml du document (les fichiers libreoffice sont des archives zip), et je lance tidy en mode autocorrection. Ça fonctionne 9 fois sur 10.

    Voici le script "fix-my-doc" que j'ai écrit pour le boulot :

     #!/bin/bash
     if [ -z "1ドル" -o "1ドル" == "-h" -o "1ドル" == "-help" -o "1ドル" == "--help" ]; then
     echo "Usage: fix-my-doc filename"
     echo " - tries to automatically repair a Libreoffice document."
     echo " - works on a copy of your file and never modifies it."
     echo " - the repaired file is prefixed with 'fixed-'."
     echo ""
     echo "Example: 0ドル /docs/BIG_QUOTE.ods will output /docs/fixed-BIG_QUOTE.ods"
     exit 0
     fi
     orig="1ドル"
     basedir="`dirname $orig`"
     fixed="$basedir/fixed-`basename $orig`"
     repairdir="/tmp/repair$$"
     content="$repairdir/content.xml"
     if [ ! -e /usr/bin/tidy ]; then
     echo "The 'tidy' util is missing, ask support to install it."
     exit 1
     fi
     if [ ! -r "$orig" ]; then
     echo "Can't read [1ドル], please check permissions / file name"
     exit 1
     fi
     if [ -e "$fixed" ]; then
     echo "Fixed document already exists [$fixed]."
     echo "Please check and remove it."
     exit 1
     fi
     cp $orig $fixed
     mkdir $repairdir
     unzip -q -d $repairdir $fixed content.xml
     tidy -q -m -xml $content
     zip -q -j -u $fixed $content
     rm $content
     rmdir $repairdir
     echo ""
     echo "Fixed file is: $fixed"
     echo "If the file is still broken, contact the support for manual recovery."
    

    Et pour la fois où ça fonctionne pas, ben faut ouvrir le content.xml dans un éditeur (genre emacs) et trouver le problème à la main, c'est très pénible.

    Bon courage !