Ticket #327: ppt2007.patch

File ppt2007.patch, 2.1 KB (added by Frank J Bruzzaniti, 15 years ago)
  • .cc

    old new (this hunk was shorter than expected)  
    351351            cout << "\"" << cmd << "\" failed - skipping\n";
    352352            return;
    353353        }
     354 +
     355    // Start: PowerPoint 2007 .pptx
     356    } else if (startswith(mimetype, "application/vnd.openxmlformats-officedocument.presentationml."))
     357    {
     358    // Inspired by http://mjr.towers.org.uk/comp/sxw2text
     359    string safefile = shell_protect(file);
     360    string cmd = "unzip -p " + safefile + " ppt/slides/slide*.xml";
     361    try {
     362        XmlParser xmlparser;
     363        xmlparser.parse_html(stdout_to_string(cmd));
     364        dump = xmlparser.dump;
     365    } catch (ReadError) {
     366        cout << "\"" << cmd << "\" failed - skipping\n";
     367        return;
     368    }
     369    // End: PowerPoint 2007 .pptx
    354370    } else if (mimetype == "application/vnd.wordperfect") {
    355371        // Looking at the source of wpd2html and wpd2text I think both output
    356372        // utf-8, but it's hard to be sure without sample Unicode .wpd files
    (this hunk was shorter than expected)  
    362409            cout << "\"" << cmd << "\" failed - skipping\n";
    363410            return;
    364411    }
    365412    } else if (mimetype == "application/vnd.ms-works") {
    366413        // wps2text produces UTF-8 output from the sample files I've tested.
    367414        string cmd = "wps2text " + shell_protect(file);
    (this hunk was shorter than expected)  
    730788    // Some other word processor formats:
    731789    mime_map["doc"] = "application/msword";
    732790    mime_map["dot"] = "application/msword"; // Word template
    733791    mime_map["wpd"] = "application/vnd.wordperfect";
    734792    mime_map["wps"] = "application/vnd.ms-works";
    735793    mime_map["wpt"] = "application/vnd.ms-works"; // Works template
     
    740799    mime_map["xls"] = "application/vnd.ms-excel";
    741800    mime_map["xlb"] = "application/vnd.ms-excel";
    742801    mime_map["xlt"] = "application/vnd.ms-excel"; // Excel template
    743802    mime_map["ppt"] = "application/vnd.ms-powerpoint";
    744803    mime_map["pps"] = "application/vnd.ms-powerpoint"; // Powerpoint slideshow
     804    mime_map["pptx"] = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; //PowerPoint 2007
    745805    // Perl:
    746806    mime_map["pl"] = "text/x-perl";
    747807    mime_map["pm"] = "text/x-perl";