ooxml

Check-in [76959afa61]
Login

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

Overview
Comment:new method view; view -activetab TAB; FR [473db708f6]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bookview
Files: files | file ages | folders
SHA3-256: 76959afa610352cf6d94c5cbf9e605b53565189f12e30ee74fc1a63aa000e75f
User & Date: alex 2019-12-09 15:12:28
References
2019-12-09
15:16 Ticket [473db708f6] set active tab status still Closed with 3 other changes artifact: 5268aaaa4e user: alex
Context
2019-12-09
16:13
view -x, -y, -height and/or -width; FR [7c58a9aac7]; Units are TWIPS: twentieths of a point = 36 points = 0.5 inches Closed-Leaf check-in: 442d25a964 user: alex tags: bookview
15:12
new method view; view -activetab TAB; FR [473db708f6] check-in: 76959afa61 user: alex tags: bookview
2019-12-08
20:51
activeTab set to 0 check-in: 9242af45ac user: alex tags: bookview
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ooxml.tcl.

148
149
150
151
152
153
154



155
156
157
158
159
160
161
...
906
907
908
909
910
911
912





913
914
915
916
917
918
919
....
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
....
2501
2502
2503
2504
2505
2506
2507













































2508
2509
2510
2511
2512
2513
2514
....
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
# 
#   method freeze sheet index
# 
#   method presetstyles
#
#   method presetsheets
#



#   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
................................................................................
	  set rid [$node getAttributeNS $xmlns(r) id]
	  foreach node [$relsRoot selectNodes {/PR:Relationships/PR:Relationship[@Id=$rid]}] {
	    if {[$node hasAttribute Target]} {
	      lappend sheets [incr idx] $sheetId $name $rid [$node @Target]
	    }
	  }
	}





      }
      $doc delete
    }
    close $fd
  }

  if {$rels} {
................................................................................

    set obj(calcChain) 0

    set obj(defaultdatestyle) 0

    array set cells {}

    set view {activetab 0}

    return 0
  }

  destructor {
    return 0
  }
................................................................................
	    foreach item $a($sheet,merge) {
	      my merge $currentSheet {*}[split $item :]
	    }
	  }
	}
      }
    }













































  }

  method debug { args } {
    foreach item $args {
      catch {
	my variable $item
	parray $item
................................................................................
    $root setAttribute xmlns $xmlns(M)
    $root setAttribute xmlns:r $xmlns(r)

    $root appendFromScript {
      Tag_fileVersion appName xl lastEdited 5 lowestEdited 5 rupBuild 5000 {}
      Tag_workbookPr showInkAnnotation 0 autoCompressPictures 0 {}
      Tag_bookViews {
	Tag_workbookView activeTab [dict get $view activetab] {}
      }
      Tag_sheets {
	for {set ws 1} {$ws <= $obj(sheets)} {incr ws} {
	  Tag_sheet name $obj(sheet,$ws) sheetId $ws r:id rId$ws {}
	}
      }
      if {0} {







>
>
>







 







>
>
>
>
>







 







|







 







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







 







|







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
...
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
....
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
....
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
....
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
# 
#   method freeze sheet index
# 
#   method presetstyles
#
#   method presetsheets
#
#   method view args
#     -avtivetab TAB -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
................................................................................
	  set rid [$node getAttributeNS $xmlns(r) id]
	  foreach node [$relsRoot selectNodes {/PR:Relationships/PR:Relationship[@Id=$rid]}] {
	    if {[$node hasAttribute Target]} {
	      lappend sheets [incr idx] $sheetId $name $rid [$node @Target]
	    }
	  }
	}
      }
      foreach node [$root selectNodes /M:workbook/M:bookViews/M:workbookView] {
        if {[$node hasAttribute activeTab]} {
	  lappend wb(view) activetab [$node @activeTab]
	}
      }
      $doc delete
    }
    close $fd
  }

  if {$rels} {
................................................................................

    set obj(calcChain) 0

    set obj(defaultdatestyle) 0

    array set cells {}

    array set view {activetab 0}

    return 0
  }

  destructor {
    return 0
  }
................................................................................
	    foreach item $a($sheet,merge) {
	      my merge $currentSheet {*}[split $item :]
	    }
	  }
	}
      }
    }

    if {[info exists a(view)]} {
      foreach item {activetab} {
        if {[dict exists $a(view) $item]} {
	  my view -$item [dict get $a(view) $item]
	}
      }
    }
  }

  method view { args } {
    my variable view

    array set opts {
      list 0
    }

    set len [llength $args]
    set idx 0
    for {set idx 0} {$idx < $len} {incr idx} {
      switch -- [set opt [lindex $args $idx]] {
        -activetab {
	  incr idx
          if {$idx < $len} {
	    if {[string is integer -strict [lindex $args $idx]] && [lindex $args $idx] > -1} {
	      set view([string range $opt 1 end]) [lindex $args $idx]
	    } else {
	      error "option '$opt': must be a positive integer"
	    }
          } else {
            error "option '$opt': missing argument"
          }            
        }
        -list {
	  set opts([string range $opt 1 end]) 1
        }
        default {
          error "unknown option \"$opt\", should be: -activetab or -list"
        }
      }
    }

    if {$opts(list)} {
      return [array get view]
    }
  }

  method debug { args } {
    foreach item $args {
      catch {
	my variable $item
	parray $item
................................................................................
    $root setAttribute xmlns $xmlns(M)
    $root setAttribute xmlns:r $xmlns(r)

    $root appendFromScript {
      Tag_fileVersion appName xl lastEdited 5 lowestEdited 5 rupBuild 5000 {}
      Tag_workbookPr showInkAnnotation 0 autoCompressPictures 0 {}
      Tag_bookViews {
	Tag_workbookView activeTab $view(activetab) {}
      }
      Tag_sheets {
	for {set ws 1} {$ws <= $obj(sheets)} {incr ws} {
	  Tag_sheet name $obj(sheet,$ws) sheetId $ws r:id rId$ws {}
	}
      }
      if {0} {

Changes to tests/formatcell.test.

837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
....
1023
1024
1025
1026
1027
1028
1029














1030
1031
1032
1033
1034
1035
1036
} 0

test FormatCellMerge-7.1 {Merge} {
  $spreadsheet merge $sheet 39,3 42,5
} 0


foreach item {obj cells fonts numFmts styles fills borders cols} {
  array set w_$item [array get ${spreadsheet}::$item]
}


test FormatCellWriteSpreatsheet-8.1 {Write Spreatsheet} {
  $spreadsheet write formatcell.xlsx
} 0
................................................................................
      }
    }
    unset -nocomplain w r
  }
  return $rc
} 1















file delete -force formatcell.xlsx


# cleanup
::tcltest::cleanupTests
return








|







 







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







837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
....
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
} 0

test FormatCellMerge-7.1 {Merge} {
  $spreadsheet merge $sheet 39,3 42,5
} 0


foreach item {obj cells fonts numFmts styles fills borders cols view} {
  array set w_$item [array get ${spreadsheet}::$item]
}


test FormatCellWriteSpreatsheet-8.1 {Write Spreatsheet} {
  $spreadsheet write formatcell.xlsx
} 0
................................................................................
      }
    }
    unset -nocomplain w r
  }
  return $rc
} 1


test FormatCellCheckView-11.1 {Check View} {
  set rc 1
  array set w [array get w_view]
  array set r $workbook(view)
  foreach {n v} [array get w] {
    if {![info exists r($n)] || $r($n) ne $v} {
      set rc 0
    }
  }
  unset -nocomplain w r
  return $rc
} 1

file delete -force formatcell.xlsx


# cleanup
::tcltest::cleanupTests
return