Changeset 23473
- Timestamp:
- 2010-12-14T11:35:25+13:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/gsConvert.pl
r22642 r23473 98 98 my ($input_type,$output_type,$verbose); 99 99 100 100 # Dynamically figure out what the --type option can support, based on whether -windows_scripting 101 # is in use or not 102 my $default_type_re = "(doc|dot|pdf|ps|ppt|rtf|xls)"; 103 #my $enhanced_type_re = "(docx?|dot|pdf|ps|pptx?|rtf|xlsx?)"; 104 #my $enhanced_type_re = "(docx?|dot|pdf|ps|pptx?|rtf|xlsx?)"; 105 # Currently only have VBA for Word and PPT(but no XLS) 106 my $enhanced_type_re = "(docx?|dot|pdf|ps|pptx?|rtf|xls)"; 107 108 my $type_re = $default_type_re; 109 110 foreach my $a (@ARGV) { 111 if ($a =~ m/^windows_scripting$/i) { 112 $type_re = $enhanced_type_re; 113 } 114 } 115 101 116 # read command-line arguments 102 117 if (!parsargv::parse(\@ARGV, 103 'type/(doc|dot|pdf|ps|ppt|rtf|xls)/', \$input_type,118 "type/$type_re/", \$input_type, 104 119 '/errlog/.*/', \$faillogfile, 105 120 'output/(auto|html|text|pagedimg).*/', \$output_type, … … 148 163 exit(1); 149 164 } 150 elsif ($input_type eq "doc"|| $input_type eq "dot") {165 elsif ($input_type =~ m/^docx?$/ || $input_type eq "dot") { 151 166 print &convertDOC($input_filename, $output_filestem, $output_type); 152 167 print "\n"; … … 164 179 print "\n"; 165 180 } 166 elsif ($input_type eq "ppt") {181 elsif ($input_type =~ m/pptx?$/) { 167 182 print &convertPPT($input_filename, $output_filestem, $output_type); 168 183 print "\n"; 169 184 } 170 elsif ($input_type eq "xls") {185 elsif ($input_type =~ m/xlsx?$/) { 171 186 print &convertXLS($input_filename, $output_filestem, $output_type); 172 187 print "\n"; … … 203 218 my $realtype = &find_docfile_type($input_filename); 204 219 205 if ($realtype eq "word6" || $realtype eq "word7" || $realtype eq "word8") { 220 if ($realtype eq "word6" || $realtype eq "word7" 221 || $realtype eq "word8" || $realtype eq "docx") { 206 222 return &convertWord678($input_filename, $output_filestem, $output_type); 207 223 } elsif ($realtype eq "rtf") { … … 455 471 sub find_docfile_type { 456 472 my ($input_filename) = @_; 457 473 474 if (($windows_scripting) && ($input_filename =~ m/\.docx$/)) { 475 return "docx"; 476 } 477 458 478 open(CHK, "<$input_filename"); 459 479 binmode(CHK); … … 477 497 if ($line =~ m/Word\.Document\.([678])/) { 478 498 close(CHK); 499 479 500 return "word$1"; 480 501 }
Note:
See TracChangeset
for help on using the changeset viewer.