ooxml

Check-in [442d25a964]
Login

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

Overview
Comment:view -x, -y, -height and/or -width; FR [7c58a9aac7]; Units are TWIPS: twentieths of a point = 36 points = 0.5 inches
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bookview
Files: files | file ages | folders
SHA3-256: 442d25a964b6746907883adf947261ed0cdeb68f1298cbe0ecfe37265098b636
User & Date: alex 2019-12-09 16:13:00
Original Comment: view -x, -y, -height and/or -width; FR [7c58a9aac7]
References
2019-12-09
16:21 Closed ticket [7c58a9aac7]: set workbook dimensions plus 6 other changes artifact: 36809a0ec6 user: alex
Context
2019-12-09
16:19
merged from bookview check-in: 96bb2a2b4e user: alex tags: trunk
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
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ooxml.tcl.

149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
...
914
915
916
917
918
919
920












921
922
923
924
925
926
927
....
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
....
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
....
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
................................................................................
	  }
	}
      }
      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} {
................................................................................
      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"
	    }
................................................................................
            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]
    }
................................................................................
    $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} {







|







 







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







 







|







 







|







 







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







149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
...
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
....
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
....
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
....
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
#   method freeze sheet index
# 
#   method presetstyles
#
#   method presetsheets
#
#   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
................................................................................
	  }
	}
      }
      foreach node [$root selectNodes /M:workbook/M:bookViews/M:workbookView] {
        if {[$node hasAttribute activeTab]} {
	  lappend wb(view) activetab [$node @activeTab]
	}
        if {[$node hasAttribute xWindow]} {
	  lappend wb(view) x [$node @xWindow]
	}
        if {[$node hasAttribute yWindow]} {
	  lappend wb(view) y [$node @yWindow]
	}
        if {[$node hasAttribute windowHeight]} {
	  lappend wb(view) height [$node @windowHeight]
	}
        if {[$node hasAttribute windowWidth]} {
	  lappend wb(view) width [$node @windowWidth]
	}
      }
      $doc delete
    }
    close $fd
  }

  if {$rels} {
................................................................................
      list 0
    }

    set len [llength $args]
    set idx 0
    for {set idx 0} {$idx < $len} {incr idx} {
      switch -- [set opt [lindex $args $idx]] {
        -activetab - -x - -y - -height - -width {
	  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"
	    }
................................................................................
            error "option '$opt': missing argument"
          }            
        }
        -list {
	  set opts([string range $opt 1 end]) 1
        }
        default {
          error "unknown option \"$opt\", should be: -activetab, -x, -y, -height, -width or -list"
        }
      }
    }

    if {$opts(list)} {
      return [array get view]
    }
................................................................................
    $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 {
	set attr {}
	foreach {n v} [array get view] {
	  switch -- $n {
	    activetab {
	      if {$v ni $obj(sheets)} {
	        set v 0
	      }
	      lappend attr activeTab $v
	    }
	    x {
	      lappend attr xWindow $v
	    }
	    y {
	      lappend attr yWindow $v
	    }
	    height {
	      lappend attr windowHeight $v
	    }
	    width {
	      lappend attr windowWidth $v
	    }
	    default {
	    }
	  }
	}
	Tag_workbookView {*}$attr {}
      }
      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.

22
23
24
25
26
27
28




29
30
31
32
33
34
35
....
1029
1030
1031
1032
1033
1034
1035

1036
1037
1038
1039
1040
1041
1042
test FormatCellNewSpreatsheet-1.1 {Create New Spreadsheet} -body {
  set spreadsheet [::ooxml::xl_write new -creator {Alexander Schöpe}]
} -result {::oo::Obj*} -match glob

test FormatCellNewWorksheet-1.2 {Create New Worksheet} {
  set sheet [$spreadsheet worksheet {Blatt 1}]
} 1





test FormatCellNewStyle-2.1 {New Style} {
  set bold [$spreadsheet style -font [$spreadsheet font -bold]]
} 1

test FormatCellNewStyle-2.2 {New Style} {
  set italic [$spreadsheet style -font [$spreadsheet font -italic]]
................................................................................


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







>
>
>
>







 







>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
....
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
test FormatCellNewSpreatsheet-1.1 {Create New Spreadsheet} -body {
  set spreadsheet [::ooxml::xl_write new -creator {Alexander Schöpe}]
} -result {::oo::Obj*} -match glob

test FormatCellNewWorksheet-1.2 {Create New Worksheet} {
  set sheet [$spreadsheet worksheet {Blatt 1}]
} 1

test FormatCellView-1.3 {Set View} {
  $spreadsheet view -activetab 0 -x 2200 -y 2760 -height 8140 -width 15140
} {}

test FormatCellNewStyle-2.1 {New Style} {
  set bold [$spreadsheet style -font [$spreadsheet font -bold]]
} 1

test FormatCellNewStyle-2.2 {New Style} {
  set italic [$spreadsheet style -font [$spreadsheet font -italic]]
................................................................................


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] {
    puts "n $n $r($n) ne $v"
    if {![info exists r($n)] || $r($n) ne $v} {
      set rc 0
    }
  }
  unset -nocomplain w r
  return $rc
} 1