ooxml

Check-in [1fcc546092]
Login

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

Overview
Comment:bug fix; added test for "named formats"
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | namedfmts
Files: files | file ages | folders
SHA3-256: 1fcc546092ca793a080162400d2e275c752cc5b8af1a3b1ce44a43f8bdd6b78b
User & Date: alex 2020-03-07 08:11:05
Context
2020-03-07
21:37
new feature "named formats" for numberformats, fonts, fills, borders and styles check-in: ea03e767f5 user: alex tags: trunk
08:11
bug fix; added test for "named formats" Closed-Leaf check-in: 1fcc546092 user: alex tags: namedfmts
2020-03-06
07:58
added "-tag" to the method "border". with this you can give a style a name. in the method "style" as BORDERID you can also pass the given name. check-in: 401fec5842 user: alex tags: namedfmts
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ooxml.tcl.

1633
1634
1635
1636
1637
1638
1639

1640
1641
1642
1643
1644
1645
1646
      red 0
      separator 0
      fraction 0
      scientific 0
      percent 0
      string 0
      text 0

    }

    set len [llength $args]
    set idx 0
    for {set idx 0} {$idx < $len} {incr idx} {
      switch -- [set opt [lindex $args $idx]] {
        -format {







>







1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
      red 0
      separator 0
      fraction 0
      scientific 0
      percent 0
      string 0
      text 0
      tag {}
    }

    set len [llength $args]
    set idx 0
    for {set idx 0} {$idx < $len} {incr idx} {
      switch -- [set opt [lindex $args $idx]] {
        -format {

Added tests/namedfmts.test.





























































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#
# Commands covered: simple excel sheet
#

#
# (c) 2019 Alexander Schoepe
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#

if {[lsearch [namespace children] ::tcltest] == -1} {
  package require tcltest 2
  namespace import -force ::tcltest::*
  loadTestedCommands
}


package require ooxml
package require vfs::zip

test NamedFormats-1.1 {Write a Simple Excel Sheet} {
  set cDT {2020-03-07 07:12:23}
  set mCT $cDT

  set spreadsheet [::ooxml::xl_write new -creator {User A} -created $cDT -modifiedby {User B} -modified $mCT -application {Tcl Test}]
  if {[set sheet [$spreadsheet worksheet {Sheet 1}]] > -1} {
    return 1
  }
  return 0
} 1


test NamedFormats-2.1 {numberformat dec2t} {
  $spreadsheet numberformat -decimal -separator -tag dec2t
} 4

test NamedFormats-2.2 {numberformat dec2t} {
  upvar #0 ${spreadsheet}::tags tags
  info exists tags(numFmts,dec2t)
} 1

test NamedFormats-2.2 {numberformat dec2t} {
  upvar #0 ${spreadsheet}::tags tags
  return $tags(numFmts,dec2t)
} 4

test NamedFormats-2.3 {style numberformat dec2t} {
  $spreadsheet style -numfmt dec2t -tag dec2t
} 1

test NamedFormats-2.4 {style numberformat dec2t} {
  upvar #0 ${spreadsheet}::tags tags
  if {[info exists tags(styles,dec2t)]} {
    return $tags(styles,dec2t)
  }
  return -1
} 1


test NamedFormats-3.1 {numberformat fraction2} {
  $spreadsheet numberformat -format {# ??/??} -tag fraction2
} 166

test NamedFormats-3.2 {numberformat fraction2} {
  upvar #0 ${spreadsheet}::tags tags
  info exists tags(numFmts,fraction2)
} 1

test NamedFormats-3.2 {numberformat fraction2} {
  upvar #0 ${spreadsheet}::tags tags
  return $tags(numFmts,fraction2)
} 166

test NamedFormats-3.3 {style numberformat fraction2} {
  $spreadsheet style -numfmt fraction2 -tag fraction2
} 2

test NamedFormats-3.4 {style numberformat fraction2} {
  upvar #0 ${spreadsheet}::tags tags
  if {[info exists tags(styles,fraction2)]} {
    return $tags(styles,fraction2)
  }
  return -1
} 2


test NamedFormats-4.1 {font font9} {
  $spreadsheet font -size 9 -tag font9
} 1

test NamedFormats-4.2 {font font9} {
  upvar #0 ${spreadsheet}::tags tags
  info exists tags(fonts,font9)
} 1

test NamedFormats-4.2 {font font9} {
  upvar #0 ${spreadsheet}::tags tags
  return $tags(fonts,font9)
} 1

test NamedFormats-4.3 {style font font9} {
  $spreadsheet style -font font9 -tag font9
} 3

test NamedFormats-4.4 {style font font9} {
  upvar #0 ${spreadsheet}::tags tags
  if {[info exists tags(styles,font9)]} {
    return $tags(styles,font9)
  }
  return -1
} 3


test NamedFormats-5.1 {fill yellow} {
  $spreadsheet fill -fgcolor FFFFFF00 -bgcolor 64 -patterntype solid -tag yellow
} 2

test NamedFormats-5.2 {fill yellow} {
  upvar #0 ${spreadsheet}::tags tags
  info exists tags(fills,yellow)
} 1

test NamedFormats-5.2 {fill yellow} {
  upvar #0 ${spreadsheet}::tags tags
  return $tags(fills,yellow)
} 2

test NamedFormats-5.3 {style fill yellow} {
  $spreadsheet style -fill yellow -tag yellow
} 4

test NamedFormats-5.4 {style fill yellow} {
  upvar #0 ${spreadsheet}::tags tags
  if {[info exists tags(styles,yellow)]} {
    return $tags(styles,yellow)
  }
  return -1
} 4


test NamedFormats-6.1 {border bDiagonal} {
  $spreadsheet border -diagonalstyle medium -diagonaldirection up -tag bDiagonal
} 1

test NamedFormats-6.2 {border bDiagonal} {
  upvar #0 ${spreadsheet}::tags tags
  info exists tags(borders,bDiagonal)
} 1

test NamedFormats-6.2 {border bDiagonal} {
  upvar #0 ${spreadsheet}::tags tags
  return $tags(borders,bDiagonal)
} 1

test NamedFormats-6.3 {style border bDiagonal} {
  $spreadsheet style -border bDiagonal -tag bDiagonal
} 5

test NamedFormats-6.4 {style border bDiagonal} {
  upvar #0 ${spreadsheet}::tags tags
  if {[info exists tags(styles,bDiagonal)]} {
    return $tags(styles,bDiagonal)
  }
  return -1
} 5


$spreadsheet destroy

# cleanup
::tcltest::cleanupTests
return