ooxml

Check-in [85d6ea0ef6]
Login

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

Overview
Comment:First version to remove "-globalstyle" from method "cell". Instead, the options of method "column" are taken as long as no local options for "-style", "-string" and/or "-nozero" are specified for "cell".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | coldefs
Files: files | file ages | folders
SHA3-256: 85d6ea0ef6c17dbd7191dd085dcc24f9c1c0d9152bc8573901e7d1196b53f08f
User & Date: alex 2020-02-14 18:59:08
Context
2020-02-14
18:59
First version to remove "-globalstyle" from method "cell". Instead, the options of method "column" are taken as long as no local options for "-style", "-string" and/or "-nozero" are specified for "cell". Leaf check-in: 85d6ea0ef6 user: alex tags: coldefs
2020-02-04
13:18
bug fix: docProps/app.xml sheet count was wrong Leaf check-in: 32d3627499 user: alex tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ooxml.tcl.

136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
....
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
....
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
....
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327


2328
2329

2330
2331


2332


2333
2334



2335
2336
2337
2338
2339
2340
2341
# 
#   method row sheet args
#     -index INDEX -height HEIGHT
#     autoincrement of row if INDEX not applied
#     return row
# 
#   method cell sheet {data {}} args
#     -index INDEX -style STYLEID -formula FORMULA -string -nozero -globalstyle -height HEIGHT
#     autoincrement of column if INDEX not applied
#     return row,column
# 
#   method autofilter sheet indexFrom indexTo
# 
#   method freeze sheet index
# 
................................................................................
#   method view args
#     -avtivetab TAB -x TWIPS -y TWIPS -height TWIPS -width TWIPS -list
#
#   method write filename
# 
#
# ::ooxml::tablelist_to_xl lb args
#   -callback CALLBACK -path PATH -file FILENAME -creator CREATOR -name NAME -rootonly -addtimestamp -globalstyle
#   Callback arguments
#     spreadsheet sheet maxcol column title width align sortmode hide
#


package require Tcl 8.6.7-
package require tdom 0.9.0-
................................................................................
  method cell { sheet {data {}} args } {
    my variable obj
    my variable cells
    my variable cols

    array set opts {
      index {}
      style 0
      formula {}
      string 0
      nozero 0
      globalstyle 0
      height {}
    }

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

    if {!$obj(callRow,$obj(sheets))} {
      set obj(callRow,$obj(sheets)) 1
      incr obj(row,$sheet)
................................................................................
    } elseif {[string trim $opts(index)] eq {}} {
      incr obj(col,$sheet)
    }
    if {$obj(row,$sheet) < 0 || $obj(col,$sheet) < 0} {
      return -1
    }

    if {$opts(globalstyle) && [string is integer -strict $opts(style)] && $opts(style) < 1} {
      if {[info exists cols($sheet,$obj(col,$sheet))] && [dict get $cols($sheet,$obj(col,$sheet)) style] >= 0} {
        set opts(style) [dict get $cols($sheet,$obj(col,$sheet)) style]


      }
    }

    if {$opts(string) == 0 && [info exists cols($sheet,$obj(col,$sheet))] && [dict get $cols($sheet,$obj(col,$sheet)) string] == 1} {
      set opts(string) 1


    }


    if {$opts(nozero) == 0 && [info exists cols($sheet,$obj(col,$sheet))] && [dict get $cols($sheet,$obj(col,$sheet)) nozero] == 1} {
      set opts(nozero) 1



    }

    set cell ${sheet},$obj(row,$sheet),$obj(col,$sheet)
    set cells($cell) {}

    if {[string is integer -strict $opts(height)] && $opts(height) > 0 && $opts(height) < 1024} {
      dict set obj(rowHeight,$sheet) $obj(row,$sheet) $opts(height)







|







 







|







 







|

|
|
|







 







|







 







|
|

>
>


>
|
|
>
>
|
>
>
|
|
>
>
>







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
....
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
....
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
....
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
# 
#   method row sheet args
#     -index INDEX -height HEIGHT
#     autoincrement of row if INDEX not applied
#     return row
# 
#   method cell sheet {data {}} args
#     -index INDEX -style STYLEID -formula FORMULA -string -nozero -height HEIGHT
#     autoincrement of column if INDEX not applied
#     return row,column
# 
#   method autofilter sheet indexFrom indexTo
# 
#   method freeze sheet index
# 
................................................................................
#   method view args
#     -avtivetab TAB -x TWIPS -y TWIPS -height TWIPS -width TWIPS -list
#
#   method write filename
# 
#
# ::ooxml::tablelist_to_xl lb args
#   -callback CALLBACK -path PATH -file FILENAME -creator CREATOR -name NAME -rootonly -addtimestamp
#   Callback arguments
#     spreadsheet sheet maxcol column title width align sortmode hide
#


package require Tcl 8.6.7-
package require tdom 0.9.0-
................................................................................
  method cell { sheet {data {}} args } {
    my variable obj
    my variable cells
    my variable cols

    array set opts {
      index {}
      style -1
      formula {}
      string -1
      nozero -1
      globalstyle {}
      height {}
    }

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

    if {!$obj(callRow,$obj(sheets))} {
      set obj(callRow,$obj(sheets)) 1
      incr obj(row,$sheet)
................................................................................
    } elseif {[string trim $opts(index)] eq {}} {
      incr obj(col,$sheet)
    }
    if {$obj(row,$sheet) < 0 || $obj(col,$sheet) < 0} {
      return -1
    }

    if {[string is integer -strict $opts(style)] && $opts(style) == -1} {
      if {[info exists cols($sheet,$obj(col,$sheet)) style] && [dict get $cols($sheet,$obj(col,$sheet)) style] >= 0} {
        set opts(style) [dict get $cols($sheet,$obj(col,$sheet)) style]
      } elseif {$opts(style) == -1} {
	set opts(style) 0
      }
    }
    if {[string is integer -strict $opts(string)] && $opts(string) == -1} {
      if {[info exists cols($sheet,$obj(col,$sheet)) string] && [dict get $cols($sheet,$obj(col,$sheet)) string] == 1} {
	set opts(string) 1
      } elseif {$opts(string) == -1} {
	set opts(string) 0
      }
    }
    if {[string is integer -strict $opts(nozero)] && $opts(nozero) == -1} {
      if {[info exists cols($sheet,$obj(col,$sheet)) nozero] && [dict get $cols($sheet,$obj(col,$sheet)) nozero] == 1} {
	set opts(nozero) 1
      } elseif {$opts(nozero) == -1} {
	set opts(nozero) 0
      }
    }

    set cell ${sheet},$obj(row,$sheet),$obj(col,$sheet)
    set cells($cell) {}

    if {[string is integer -strict $opts(height)] && $opts(height) > 0 && $opts(height) < 1024} {
      dict set obj(rowHeight,$sheet) $obj(row,$sheet) $opts(height)