ooxml

Check-in [bcad321da9]
Login

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

Overview
Comment:added "-tag" to the method "styles". with this you can give a style a name. in the methods "defaultdatestyle", "column" and "cell" as STYLEID you can also pass the given name.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | namedfmts
Files: files | file ages | folders
SHA3-256: bcad321da96b360e8e53f14a7851c3040827b693e491491e0698b03231dc70ef
User & Date: alex 2020-03-05 21:33:23
Original Comment: "-tag" to the method "styles". with this you can give a style a name. in the methods "defaultdatestyle", "column" and "cell" as STYLEID you can also pass the given name.
Context
2020-03-06
07:46
added "-tag" to the method "numberformat". with this you can give a style a name. in the method "style" as NUMFMTID you can also pass the given name. check-in: c894d762dd user: alex tags: namedfmts
2020-03-05
21:33
added "-tag" to the method "styles". with this you can give a style a name. in the methods "defaultdatestyle", "column" and "cell" as STYLEID you can also pass the given name. check-in: bcad321da9 user: alex tags: namedfmts
19:35
ignore "-globalstyle" in versions > 1.5; styles are from now on predefined via method "column" and can be overwritten in method "cell" check-in: 9fc2848c8f user: alex tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ooxml.tcl.

1506
1507
1508
1509
1510
1511
1512

1513
1514
1515
1516
1517
1518
1519
1520


1521
1522
1523
1524
1525
1526
1527
....
1746
1747
1748
1749
1750
1751
1752

1753



1754
1755
1756
1757
1758
1759
1760
....
2018
2019
2020
2021
2022
2023
2024

2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036

2037
2038
2039
2040
2041
2042
2043
....
2047
2048
2049
2050
2051
2052
2053













2054
2055
2056
2057
2058
2059
2060
2061
2062
....
2097
2098
2099
2100
2101
2102
2103



2104
2105
2106
2107
2108
2109
2110
2111
2112
2113



2114
2115
2116
2117
2118
2119
2120
....
2134
2135
2136
2137
2138
2139
2140

2141
2142
2143
2144
2145
2146
2147
....
2167
2168
2169
2170
2171
2172
2173




2174
2175
2176
2177
2178
2179
2180
....
2266
2267
2268
2269
2270
2271
2272

2273
2274
2275
2276
2277
2278
2279
....
2299
2300
2301
2302
2303
2304
2305




2306
2307
2308
2309
2310
2311
2312
    my variable fonts
    my variable numFmts
    my variable styles
    my variable fills
    my variable borders
    my variable cols
    my variable view


    array set opts {
      creator {unknown}
      created {}
      modifiedby {}
      modified {}
      application {}
    }



    set len [llength $args]
    set idx 0
    for {set idx 0} {$idx < $len} {incr idx} {
      switch -- [set opt [lindex $args $idx]] {
        -creator - -created - -modifiedby - -modified - -application {
	  incr idx
................................................................................
    incr obj(numFmts)

    return $idx
  }

  method defaultdatestyle { style } {
    my variable obj





    set obj(defaultdatestyle) $style
  }

  method font { args } {
    my variable obj
    my variable fonts

................................................................................
    
    return $idx
  }

  method style { args } {
    my variable obj
    my variable styles


    array set opts {
      list 0
      numfmt 0
      font 0
      fill 0
      border 0
      xf 0
      horizontal {}
      vertical {}
      rotate {}
      wrap 0

    }

    set len [llength $args]
    set idx 0
    for {set idx 0} {$idx < $len} {incr idx} {
      switch -- [set opt [lindex $args $idx]] {
        -numfmt - -font - -fill - -border - -xf - -horizontal - -vertical - -rotate {
................................................................................
          } else {
            error "option '$opt': missing argument"
          }            
        }
        -list - -wrap {
	  set opts([string range $opt 1 end]) 1
        }













        default {
          error "unknown option \"$opt\", should be: -numfmt, -font, -fill, -border, -xf, -horizontal, -vertical, -rotate, -list or -wrap"
        }
      }
    }

    if {$opts(list)} {
      return [array get styles]
    }
................................................................................
      foreach name [array names a] {
        if {$a($name) ne $opts($name)} {
	  set found 0
	  break
	}
      }
      if {$found} {



        return $idx
      }
    }

    set styles($obj(styles)) {}
    foreach item {numfmt font fill border xf horizontal vertical rotate wrap} {
      lappend styles($obj(styles)) $item $opts($item)
    }
    set idx $obj(styles)
    incr obj(styles)



    return $idx
  }

  method worksheet { name } {
    my variable obj

    incr obj(sheets)
................................................................................

    return $obj(sheets)
  }

  method column { sheet args } {
    my variable obj
    my variable cols


    array set opts {
      index {}
      to {}
      width {}
      style 0
      bestfit 0
................................................................................
	  set opts([string range $opt 1 end]) 1
        }
        default {
          error "unknown option \"$opt\", should be: -index, -to, -width, -style, -bestfit, -customwidth, -string, -nozero or -calcfit"
        }
      }
    }





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

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


    array set opts {
      index {}
      style -1
      formula {}
      string -1
      nostring -1
................................................................................
	  set opts([string range $opt 1 end]) 1
        }
        default {
          error "unknown option \"$opt\", should be: -index, -style, -formula, -height, -string, nostring, -zero or -nozero"
        }
      }
    }





    if {$opts(nostring) == 1} {
      set opts(string) 0
    }
    if {$opts(zero) == 1} {
      set opts(nozero) 0
    }







>








>
>







 







>

>
>
>







 







>












>







 







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

|







 







>
>
>










>
>
>







 







>







 







>
>
>
>







 







>







 







>
>
>
>







1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
....
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
....
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
....
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
....
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
....
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
....
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
....
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
....
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
    my variable fonts
    my variable numFmts
    my variable styles
    my variable fills
    my variable borders
    my variable cols
    my variable view
    my variable tags

    array set opts {
      creator {unknown}
      created {}
      modifiedby {}
      modified {}
      application {}
    }

    array set tags {}

    set len [llength $args]
    set idx 0
    for {set idx 0} {$idx < $len} {incr idx} {
      switch -- [set opt [lindex $args $idx]] {
        -creator - -created - -modifiedby - -modified - -application {
	  incr idx
................................................................................
    incr obj(numFmts)

    return $idx
  }

  method defaultdatestyle { style } {
    my variable obj
    my variable tags

    if {![string is integer -strict $style] && [info exists tags(styles,$style)]} {
      set style $tags(styles,$style)]
    }
    set obj(defaultdatestyle) $style
  }

  method font { args } {
    my variable obj
    my variable fonts

................................................................................
    
    return $idx
  }

  method style { args } {
    my variable obj
    my variable styles
    my variable tags

    array set opts {
      list 0
      numfmt 0
      font 0
      fill 0
      border 0
      xf 0
      horizontal {}
      vertical {}
      rotate {}
      wrap 0
      tag {}
    }

    set len [llength $args]
    set idx 0
    for {set idx 0} {$idx < $len} {incr idx} {
      switch -- [set opt [lindex $args $idx]] {
        -numfmt - -font - -fill - -border - -xf - -horizontal - -vertical - -rotate {
................................................................................
          } else {
            error "option '$opt': missing argument"
          }            
        }
        -list - -wrap {
	  set opts([string range $opt 1 end]) 1
        }
        -tag {
	  incr idx
          if {$idx < $len} {
	    if {[string is integer -strict [set tag [lindex $args $idx]]]} {
	      error "option '$opt': should not be an integer value"
	    } else {
	      set opts([string range $opt 1 end]) $tag
	    } 
	    unset tag
          } else {
            error "option '$opt': missing argument"
          }            
        }
        default {
          error "unknown option \"$opt\", should be: -numfmt, -font, -fill, -border, -xf, -horizontal, -vertical, -rotate, -list, -wrap or -tag"
        }
      }
    }

    if {$opts(list)} {
      return [array get styles]
    }
................................................................................
      foreach name [array names a] {
        if {$a($name) ne $opts($name)} {
	  set found 0
	  break
	}
      }
      if {$found} {
	if {$opts(tag) ne {}} {
	  set tags(styles,$opts(tag)) $idx
	}
        return $idx
      }
    }

    set styles($obj(styles)) {}
    foreach item {numfmt font fill border xf horizontal vertical rotate wrap} {
      lappend styles($obj(styles)) $item $opts($item)
    }
    set idx $obj(styles)
    incr obj(styles)
    if {$opts(tag) ne {}} {
      set tags(styles,$opts(tag)) $idx
    }
    return $idx
  }

  method worksheet { name } {
    my variable obj

    incr obj(sheets)
................................................................................

    return $obj(sheets)
  }

  method column { sheet args } {
    my variable obj
    my variable cols
    my variable tags

    array set opts {
      index {}
      to {}
      width {}
      style 0
      bestfit 0
................................................................................
	  set opts([string range $opt 1 end]) 1
        }
        default {
          error "unknown option \"$opt\", should be: -index, -to, -width, -style, -bestfit, -customwidth, -string, -nozero or -calcfit"
        }
      }
    }

    if {![string is integer -strict $opts(style)] && [info exists tags(styles,$opts(style))]} {
      set opts(style) $tags(styles,$opts(style))
    }

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

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

    array set opts {
      index {}
      style -1
      formula {}
      string -1
      nostring -1
................................................................................
	  set opts([string range $opt 1 end]) 1
        }
        default {
          error "unknown option \"$opt\", should be: -index, -style, -formula, -height, -string, nostring, -zero or -nozero"
        }
      }
    }

    if {![string is integer -strict $opts(style)] && [info exists tags(styles,$opts(style))]} {
      set opts(style) $tags(styles,$opts(style))
    }

    if {$opts(nostring) == 1} {
      set opts(string) 0
    }
    if {$opts(zero) == 1} {
      set opts(nozero) 0
    }