ooxml

Check-in [892e75295d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:new method cells = pass a line as list
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | cells
Files: files | file ages | folders
SHA3-256: 892e75295d1fa50fb2cad0e43c87c1484146ac08b823961cf93082ae35e385da
User & Date: alex 2020-03-09 12:53:41
Context
2020-03-09
12:53
new method cells = pass a line as list Leaf check-in: 892e75295d user: alex tags: cells
2020-03-08
06:58
short doc update Leaf check-in: 38e545bbb2 user: alex tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ooxml.tcl.

2591
2592
2593
2594
2595
2596
2597













































































2598
2599
2600
2601
2602
2603
2604
      if {$obj(col,$sheet) > $obj(dmaxcol,$sheet)} {
	set obj(dmaxcol,$sheet) $obj(col,$sheet)
      }
    }
    
    return $obj(row,$sheet),$obj(col,$sheet)
  }














































































  method autofilter { sheet indexFrom indexTo } {
    my variable obj

    set indexFrom [::ooxml::IndexToString $indexFrom]
    set indexTo [::ooxml::IndexToString $indexTo]
    if {$indexFrom ne {} && $indexTo ne {}} {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
      if {$obj(col,$sheet) > $obj(dmaxcol,$sheet)} {
	set obj(dmaxcol,$sheet) $obj(col,$sheet)
      }
    }
    
    return $obj(row,$sheet),$obj(col,$sheet)
  }

  method cells { sheet {data {}} args } {
    my variable obj
    my variable cells
    my variable cols
    my variable tags

    array set opts {
      index {}
      style -1
      string -1
      nostring -1
      zero -1
      nozero -1
      height {}
    }

    set len [llength $args]
    set idx 0
    for {set idx 0} {$idx < $len} {incr idx} {
      switch -- [set opt [lindex $args $idx]] {
        -index - -style - -height {
	  incr idx
          if {$idx < $len} {
            set opts([string range $opt 1 end]) [lindex $args $idx]
          } else {
            error "option '$opt': missing argument"
          }            
        }
        -string - -nostring - -zero - -nozero {
	  set opts([string range $opt 1 end]) 1
        }
        default {
          error "unknown option \"$opt\", should be: -index, -style, -height, -string, nostring, -zero or -nozero"
        }
      }
    }

    if {!$obj(callRow,$obj(sheets))} {
      set obj(callRow,$obj(sheets)) 1
      incr obj(row,$sheet)
    }

    if {[regexp {^\d+$} $opts(index)] && $opts(index) > -1} {
      set obj(col,$sheet) $opts(index)
    } elseif {[regexp {^[A-Z]+$} $opts(index)]} {
      set obj(col,$sheet) [lindex [split [::ooxml::StringToRowColumn $opts(index)] ,] end]
    } elseif {[regexp {^(\d+),(\d+)$} $opts(index)]} {
      lassign [split $opts(index) ,] obj(row,$sheet) obj(col,$sheet)
    } elseif {[regexp {^[A-Z]+\d+$} $opts(index)]} {
      lassign [split [::ooxml::StringToRowColumn $opts(index)] ,] obj(row,$sheet) obj(col,$sheet)
    } elseif {[string trim $opts(index)] eq {}} {
      incr obj(col,$sheet)
    }
    if {$obj(row,$sheet) < 0 || $obj(col,$sheet) < 0} {
      return -1
    }

    set args {-index}
    lappend args $obj(row,$sheet),$obj(col,$sheet)
    foreach item {style string nostring zero nozero} {
      if {$opts($item) ne {} && $opts($item) != -1} {
	lappend args -$item $opts($item)
      }
    }
    if {$opts(height) ne {}} {
      lappend args -height $opts(height)
    }

    foreach cell $data {
      if {[string trim $cell] ne {}} {
	my cell $sheet $cell {*}$args
      }
    }
    
    return $obj(row,$sheet)
  }

  method autofilter { sheet indexFrom indexTo } {
    my variable obj

    set indexFrom [::ooxml::IndexToString $indexFrom]
    set indexTo [::ooxml::IndexToString $indexTo]
    if {$indexFrom ne {} && $indexTo ne {}} {