/[webpac]/trunk/all2xml.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/all2xml.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 54 by dpavlin, Mon Jun 23 20:20:32 2003 UTC revision 57 by dpavlin, Fri Jul 4 15:05:23 2003 UTC
# Line 33  getopts('d:m:qs', \%opts); Line 33  getopts('d:m:qs', \%opts);
33    
34  my $path;       # this is name of database  my $path;       # this is name of database
35    
36  Text::Iconv->raise_error(1);     # Conversion errors raise exceptions  Text::Iconv->raise_error(0);     # Conversion errors don't raise exceptions
37    
38  # this is encoding of all files on disk, including import_xml/*.xml file and  # this is encoding of all files on disk, including import_xml/*.xml file and
39  # filter/*.pm files! It will be used to store strings in perl internally!  # filter/*.pm files! It will be used to store strings in perl internally!
# Line 247  print STDERR "reading ./import_xml/$type Line 247  print STDERR "reading ./import_xml/$type
247          sub progress {          sub progress {
248                  #return if (! $opts{q});        # FIXME                  #return if (! $opts{q});        # FIXME
249                  my $current = shift;                  my $current = shift;
250                  my $total = shift;                  my $total = shift || 1;
251                  my $p = int($current * 100 / $total);                  my $p = int($current * 100 / $total);
252                  if ($p != $last_p) {                  if ($p != $last_p) {
253                          printf STDERR ("%5d / %5d [%-51s] %-2d %% \r",$current,$total,"=" x ($p/2).">", $p );                          printf STDERR ("%5d / %5d [%-51s] %-2d %% \r",$current,$total,"=" x ($p/2).">", $p );
# Line 297  print STDERR "using: $type...\n"; Line 297  print STDERR "using: $type...\n";
297                  my $excel_file = $cfg -> val($database, 'excel_file') || die "$database doesn't have 'excel_file' defined!";                  my $excel_file = $cfg -> val($database, 'excel_file') || die "$database doesn't have 'excel_file' defined!";
298    
299                  my $sheet = x($config->{sheet}) || die "no sheet in $type.xml";                  my $sheet = x($config->{sheet}) || die "no sheet in $type.xml";
300                  my $start_row = x($config->{start_row}) || die "no start_row in $type.xml";                  my $start_row = x($config->{start_row}) - 1 || die "no start_row in $type.xml";
301    
302                  my $oBook = Spreadsheet::ParseExcel::Workbook->Parse($excel_file) || die "can't open Excel file '$excel_file'";                  my $oBook = Spreadsheet::ParseExcel::Workbook->Parse($excel_file) || die "can't open Excel file '$excel_file'";
303    
# Line 314  print STDERR "using: $type...\n"; Line 314  print STDERR "using: $type...\n";
314                  defined ($oWorksheet) || die "can't find sheet '$sheet' in $excel_file";                  defined ($oWorksheet) || die "can't find sheet '$sheet' in $excel_file";
315                  my $end_row = x($config->{end_row}) || $oWorksheet->{MaxRow};                  my $end_row = x($config->{end_row}) || $oWorksheet->{MaxRow};
316    
317                  for(my $iR = $oWorksheet->{MinRow} ; defined $end_row && $iR <= $end_row ; $iR++) {                  for(my $iR = $start_row ; defined $end_row && $iR <= $end_row ; $iR++) {
318                          my $row;                          my $row;
319                          for(my $iC = $oWorksheet->{MinCol} ; defined $oWorksheet->{MaxCol} && $iC <= $oWorksheet->{MaxCol} ; $iC++) {                          for(my $iC = $oWorksheet->{MinCol} ; defined $oWorksheet->{MaxCol} && $iC <= $oWorksheet->{MaxCol} ; $iC++) {
320                                  my $cell = $oWorksheet->{Cells}[$iR][$iC];                                  my $cell = $oWorksheet->{Cells}[$iR][$iC];

Legend:
Removed from v.54  
changed lines
  Added in v.57

  ViewVC Help
Powered by ViewVC 1.1.26