Objectif
Visualiser les correspondances entre NumberFormat et l'affichage d'une valeur numérique. Mais le doute persiste encore pour mon format monétaire...A creuser...
Macro
sub Format_nombredim oDoc as object
dim oFeuille as object
dim oZone as object
dim oCell as object
test=1234.1234
oDoc = thisComponent
oFeuille = oDoc.CurrentController.ActiveSheet
oCell = oFeuille.getCellRangeByName("A1")
oCell.String="Valeur initiale"
oCell = oFeuille.getCellRangeByName("B1")
ocell.value=test
oCell = oFeuille.getCellRangeByName("A3")
oCell.String="Tableau des valeurs NumberFormat"
oCell = oFeuille.getCellRangeByName("A4")
oCell.String="NumberFormat"
oCell = oFeuille.getCellRangeByName("B4")
oCell.String="Affichage"
for i =0 to 1000
oCell = oFeuille.getCellRangeByName("A"+Ltrim(str(i+5))+"")
ocell.value=i
oCell = oFeuille.getCellRangeByName("B"+Ltrim(str(i+5))+"")
oCell.NumberFormat = i
oCell.Value = test
oCell = oFeuille.getCellRangeByName("C"+Ltrim(str(i+5))+"")
oCell.NumberFormat = i
oCell.Value = -test
next i
end sub
A retenir
3 => séparateurs de millier38 => date complète
107 => format monétaire (mais plutôt 108 pour une raison qui m'échappe)
Résultat du script pour les 200 premières lignes
NumberFormat |
Affichage |
|
0 |
1234,12 |
-1234,12 |
1 |
1234 |
-1234 |
2 |
1234,12 |
-1234,12 |
3 |
1 234 |
-1 234 |
4 |
1 234,12 |
-1 234,12 |
5 |
1 234,12 |
-1 234,12 |
6 |
1234,12 |
-1234,12 |
7 |
1234,12 |
-1234,12 |
8 |
1234,12 |
-1234,12 |
9 |
1234,12 |
-1234,12 |
10 |
123412 % |
-123412 % |
11 |
123412,34 % |
-123412,34 % |
12 |
1234,12 |
-1234,12 |
13 |
1234,12 |
-1234,12 |
14 |
1234,12 |
-1234,12 |
15 |
1234,12 |
-1234,12 |
16 |
1234,12 |
-1234,12 |
17 |
1234,12 |
-1234,12 |
18 |
1234,12 |
-1234,12 |
19 |
1234,12 |
-1234,12 |
20 |
1 234 F |
-1 234 F |
21 |
1 234,12 F |
-1 234,12 F |
22 |
1 234 F |
-1 234 F |
23 |
1 234,12 F |
-1 234,12 F |
24 |
1 234,12 FRF |
-1 234,12 FRF |
25 |
1 234,12 F |
-1 234,12 F |
26 |
1234,12 |
-1234,12 |
27 |
1234,12 |
-1234,12 |
28 |
1234,12 |
-1234,12 |
29 |
1234,12 |
-1234,12 |
30 |
18/05/1903 |
12/08/1896 |
31 |
lun. 18/mai 03 |
mer. 12/août 96 |
32 |
05/03 |
08/96 |
33 |
18/mai |
12/août |
34 |
mai |
août |
35 |
2e trimestre 03 |
3e trimestre 96 |
36 |
18/05/1903 |
12/08/1896 |
37 |
18/05/03 |
12/08/96 |
38 |
lundi 18 mai 1903 |
mercredi 12 août 1896 |
39 |
18 mai 03 |
12 août 96 |
40 |
18 mai 1903 |
12 août 1896 |
41 |
18 mai 1903 |
12 août 1896 |
42 |
lun. 18 mai 03 |
mer. 12 août 96 |
43 |
lun. 18 mai 1903 |
mer. 12 août 1896 |
44 |
lundi 18 mai 1903 |
mercredi 12 août 1896 |
45 |
18. mai 1903 |
12. août 1896 |
46 |
18. mai 1903 |
12. août 1896 |
47 |
05-18 |
08-12 |
48 |
03-05-18 |
96-08-12 |
49 |
1903-05-18 |
1896-08-12 |
50 |
21 |
33 |
51 |
1234,12 |
-1234,12 |
52 |
1234,12 |
-1234,12 |
53 |
1234,12 |
-1234,12 |
54 |
1234,12 |
-1234,12 |
55 |
1234,12 |
-1234,12 |
56 |
1234,12 |
-1234,12 |
57 |
1234,12 |
-1234,12 |
58 |
1234,12 |
-1234,12 |
59 |
1234,12 |
-1234,12 |
60 |
02:57 |
21:02 |
61 |
02:57:41 |
21:02:18 |
62 |
02:57 AM |
09:02 PM |
63 |
02:57:41 AM |
09:02:18 PM |
64 |
29618:57:42 |
-29618:57:42 |
65 |
57:41,76 |
02:18,24 |
66 |
29618:57:41,76 |
-29618:57:41,76 |
67 |
1234,12 |
-1234,12 |
68 |
1234,12 |
-1234,12 |
69 |
1234,12 |
-1234,12 |
70 |
18/05/03 02:57 |
12/08/96 21:02 |
71 |
18/05/1903 02:57:41 |
12/08/1896 21:02:18 |
72 |
18/05/1903 02:57 |
12/08/1896 21:02 |
73 |
1903-05-18 02:57:41 |
1896-08-12 21:02:18 |
74 |
1903-05-18 02:57:41,760 |
1896-08-12 21:02:18,240 |
75 |
1903-05-18T02:57:41 |
1896-08-12T21:02:18 |
76 |
1903-05-18T02:57:41,760 |
1896-08-12T21:02:18,240 |
77 |
1234,12 |
-1234,12 |
78 |
1234,12 |
-1234,12 |
79 |
1234,12 |
-1234,12 |
80 |
1,23E+003 |
-1,23E+003 |
81 |
1,23E+03 |
-1,23E+03 |
82 |
1234,12 |
-1234,12 |
83 |
1234,12 |
-1234,12 |
84 |
1234,12 |
-1234,12 |
85 |
1234 1/8 |
-1234 1/8 |
86 |
1234 10/81 |
-1234 10/81 |
87 |
1234 106/859 |
-1234 106/859 |
88 |
1234 |
-1234 |
89 |
1234 |
-1234 |
90 |
1234 1/8 |
-1234 1/8 |
91 |
1234 2/16 |
-1234 2/16 |
92 |
1234 1/10 |
-1234 1/10 |
93 |
1234 12/100 |
-1234 12/100 |
94 |
1234,12 |
-1234,12 |
95 |
1234,12 |
-1234,12 |
96 |
1234,12 |
-1234,12 |
97 |
1234,12 |
-1234,12 |
98 |
1234,12 |
-1234,12 |
99 |
VRAI |
VRAI |
100 |
1234,12 |
-1234,12 |
101 |
1 234 F |
-1 234 F |
102 |
1 234,12 F |
-1 234,12 F |
103 |
1 234 F |
-1 234 F |
104 |
1 234,12 F |
-1 234,12 F |
105 |
1 234,12 F |
-1 234,12 F |
106 |
1,23E+03 |
-1,23E+03 |
107 |
1 234,12 € |
-1 234,12 € |
108 |
1234,12 |
-1234,12 |
109 |
1234,12 |
-1234,12 |
110 |
1234,12 |
-1234,12 |
111 |
1234,12 |
-1234,12 |
112 |
1234,12 |
-1234,12 |
113 |
1234,12 |
-1234,12 |
114 |
1234,12 |
-1234,12 |
115 |
1234,12 |
-1234,12 |
116 |
1234,12 |
-1234,12 |
117 |
1234,12 |
-1234,12 |
118 |
1234,12 |
-1234,12 |
119 |
1234,12 |
-1234,12 |
120 |
1234,12 |
-1234,12 |
121 |
1234,12 |
-1234,12 |
122 |
1234,12 |
-1234,12 |
123 |
1234,12 |
-1234,12 |
124 |
1234,12 |
-1234,12 |
125 |
1234,12 |
-1234,12 |
126 |
1234,12 |
-1234,12 |
127 |
1234,12 |
-1234,12 |
128 |
1234,12 |
-1234,12 |
129 |
1234,12 |
-1234,12 |
130 |
1234,12 |
-1234,12 |
131 |
1234,12 |
-1234,12 |
132 |
1234,12 |
-1234,12 |
133 |
1234,12 |
-1234,12 |
134 |
1234,12 |
-1234,12 |
135 |
1234,12 |
-1234,12 |
136 |
1234,12 |
-1234,12 |
137 |
1234,12 |
-1234,12 |
138 |
1234,12 |
-1234,12 |
139 |
1234,12 |
-1234,12 |
140 |
1234,12 |
-1234,12 |
141 |
1234,12 |
-1234,12 |
142 |
1234,12 |
-1234,12 |
143 |
1234,12 |
-1234,12 |
144 |
1234,12 |
-1234,12 |
145 |
1234,12 |
-1234,12 |
146 |
1234,12 |
-1234,12 |
147 |
1234,12 |
-1234,12 |
148 |
1234,12 |
-1234,12 |
149 |
1234,12 |
-1234,12 |
150 |
1234,12 |
-1234,12 |
151 |
1234,12 |
-1234,12 |
152 |
1234,12 |
-1234,12 |
153 |
1234,12 |
-1234,12 |
154 |
1234,12 |
-1234,12 |
155 |
1234,12 |
-1234,12 |
156 |
1234,12 |
-1234,12 |
157 |
1234,12 |
-1234,12 |
158 |
1234,12 |
-1234,12 |
159 |
1234,12 |
-1234,12 |
160 |
1234,12 |
-1234,12 |
161 |
1234,12 |
-1234,12 |
162 |
1234,12 |
-1234,12 |
163 |
1234,12 |
-1234,12 |
164 |
1234,12 |
-1234,12 |
165 |
1234,12 |
-1234,12 |
166 |
1234,12 |
-1234,12 |
167 |
1234,12 |
-1234,12 |
168 |
1234,12 |
-1234,12 |
169 |
1234,12 |
-1234,12 |
170 |
1234,12 |
-1234,12 |
171 |
1234,12 |
-1234,12 |
172 |
1234,12 |
-1234,12 |
173 |
1234,12 |
-1234,12 |
174 |
1234,12 |
-1234,12 |
175 |
1234,12 |
-1234,12 |
176 |
1234,12 |
-1234,12 |
177 |
1234,12 |
-1234,12 |
178 |
1234,12 |
-1234,12 |
179 |
1234,12 |
-1234,12 |
180 |
1234,12 |
-1234,12 |
181 |
1234,12 |
-1234,12 |
182 |
1234,12 |
-1234,12 |
183 |
1234,12 |
-1234,12 |
184 |
1234,12 |
-1234,12 |
185 |
1234,12 |
-1234,12 |
186 |
1234,12 |
-1234,12 |
187 |
1234,12 |
-1234,12 |
188 |
1234,12 |
-1234,12 |
189 |
1234,12 |
-1234,12 |
190 |
1234,12 |
-1234,12 |
191 |
1234,12 |
-1234,12 |
192 |
1234,12 |
-1234,12 |
193 |
1234,12 |
-1234,12 |
194 |
1234,12 |
-1234,12 |
195 |
1234,12 |
-1234,12 |
196 |
1234,12 |
-1234,12 |
197 |
1234,12 |
-1234,12 |
198 |
1234,12 |
-1234,12 |
199 |
1234,12 |
-1234,12 |
200 |
1234,12 |
-1234,12 |
Aucun commentaire:
Enregistrer un commentaire
Tout commentaire nous engage ;)