#!/bin/bash # script to ease export of Open Office odp files # into HTML format # the script is designed for the "standart with frames" option show_info () { cat <<EOF STEP BY STEP TO CHANGE OPEN OFFICE ODP TO HTML (create presentation or open it...) * Go to File > export ... * create new folder (odpExport) * use "index" as filename (helps in future) * save >> wizard starts * choose "Standart HTML with frames" * choose "Create title page" NO (if you want a title page you will have to insert a page later to not mess up the page order) wizard * finish wizzard * change to outline view * select all * copy * create new TEXT document (you have to choose text not HTML in order to insert page breaks) * insert * change the paragraph style of those title that should start a new html page. It is probably the "default Titel" or similar. * go to edit paragraph style > Text flow * Breaks > insert > PAGE * use File > Save As... * choose Filter : HTML Document .... * give a name (tempfile) * save * create a new first page the first page acts like the master slide. All items on this page are copied to all the html pages, including graphics. The layout is however a little tricky (but at least you do not have to copy and paste all the time...) * adjust font size, fonts, background colour, etc to change background color: Format>Page>Background to adjust fonts quickly: select all, Format>default formatting * save the page (it should already be HTML) use the script * open console use odp2html <name-of-newly created-html-file> [<folder created by export>] if you give a folder name the newly created html pages will be copied there. odp2html will in any way create a new folder. If the folder exists already, you have to remove or rename it first. * >odp2html tempfile.html odpExport It will create a folder tempfile with all new html pages in. Then it will copy these pages to odpExport folder, the folder that contains our exported opd file. * open odpExport/index.html and see the result EOF } if [[ -z "$1" ]] || [[ ! -f "$1" ]] then echo "Usage: $0 html-file [folder] creates a new folder with new html-pages. Each page break in html-file makes a new html page. If folder is given all newly created html pages are copied there. Careful. Overwrites files --help for full information " exit fi if [[ "$1" == "--help" ]] then show_info exit fi FOLDER="${1%.html}" if ! mkdir "$FOLDER" then echo "Folder $FOLDER exists. " exit fi a="-2" # redirects the head until first Paragraph, img-2.html is head # img-1 is first page, i.e. master slide (background) # img0 is first slide touch "$FOLDER/img-1.html" while read A do echo "$A" >> "$FOLDER/img$a.html" if echo "$A" |grep "page-break-before: always" then let a+=1 cat "$FOLDER/img-2.html" "$FOLDER/img-1.html" > "$FOLDER"/img$a.html fi done <"$1" # copy files to folder if [[ ! -z "$2" ]] then echo "copy files to $2 (y/n)" read answer [[ ! "$answer" == "y" ]]&& exit cp -f "$FOLDER"/img*.html "$2"/. fi exit 0