forked from sheetjs/sheetjs
		
	Parse font bold-italic-strike-outline-shadow-superscript-subscript
This commit is contained in:
		
							parent
							
								
									27a300b862
								
							
						
					
					
						commit
						37a031caee
					
				| @ -49,20 +49,36 @@ function parse_fonts(t, opts) { | ||||
|   t[0].match(tagregex).forEach(function(x) { | ||||
|     var y = parsexmltag(x); | ||||
|     switch(y[0]) { | ||||
| 
 | ||||
|       case '<fonts': case  '<fonts>': case '</fonts>': break; | ||||
|       case '<font>': break; | ||||
|       case '</font>': styles.Fonts.push(font); font = {}; break; | ||||
|       case '<font': | ||||
|         break; | ||||
|       case '</font>': styles.Fonts.push(font); console.log(font);font = {}; break; | ||||
| 
 | ||||
|       case '<name': | ||||
|         if(y.val) font.name = y.val; | ||||
|         break; | ||||
|       case '<name/>': case '</name>': break; | ||||
| 
 | ||||
| 
 | ||||
|       case '<b/>': font.bold = true;break; | ||||
|       case '<u/>':  font.underline = true;break; | ||||
|       case '<i/>':  font.italic = true;break; | ||||
|       case '<strike/>':  font.strike = true;break; | ||||
|       case '<outline/>':  font.outline = true;break; | ||||
|       case '<shadow/>':  font.shadow = true;break; | ||||
| 
 | ||||
| 
 | ||||
|       case '<sz': | ||||
|         if(y.val) font.sz = y.val; | ||||
|         break; | ||||
|       case '<sz/>': case '</sz>': break; | ||||
| 
 | ||||
|       case '<vertAlign': | ||||
|         if(y.val) font.vertAlign = y.val; | ||||
|         break; | ||||
|       case '<vertAlign/>': case '</vertAlign>': break; | ||||
| 
 | ||||
| 
 | ||||
|       case '<color': | ||||
|         if (!font.color) font.color = {}; | ||||
|  | ||||
| @ -215,6 +215,13 @@ if ((typeof 'module' != 'undefined'  && typeof require != 'undefined') || (typeo | ||||
|         if (attributes.bold) $font.append(XmlNode('b')); | ||||
|         if (attributes.underline)  $font.append(XmlNode('u')); | ||||
|         if (attributes.italic)  $font.append(XmlNode('i')); | ||||
|         if (attributes.strike)  $font.append(XmlNode('strike')); | ||||
|         if (attributes.outline)  $font.append(XmlNode('outline')); | ||||
|         if (attributes.shadow)  $font.append(XmlNode('shadow')); | ||||
| 
 | ||||
|         if (attributes.vertAlign) { | ||||
|           $font.append(XmlNode('vertAlign').attr('val', attributes.vertAlign)) | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         if (attributes.color) { | ||||
|  | ||||
							
								
								
									
										27
									
								
								xlsx.js
									
									
									
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										27
									
								
								xlsx.js
									
									
									
									
									
								
							| @ -2241,20 +2241,36 @@ function parse_fonts(t, opts) { | ||||
|   t[0].match(tagregex).forEach(function(x) { | ||||
|     var y = parsexmltag(x); | ||||
|     switch(y[0]) { | ||||
| 
 | ||||
|       case '<fonts': case  '<fonts>': case '</fonts>': break; | ||||
|       case '<font>': break; | ||||
|       case '</font>': styles.Fonts.push(font); font = {}; break; | ||||
|       case '<font': | ||||
|         break; | ||||
|       case '</font>': styles.Fonts.push(font); console.log(font);font = {}; break; | ||||
| 
 | ||||
|       case '<name': | ||||
|         if(y.val) font.name = y.val; | ||||
|         break; | ||||
|       case '<name/>': case '</name>': break; | ||||
| 
 | ||||
| 
 | ||||
|       case '<b/>': font.bold = true;break; | ||||
|       case '<u/>':  font.underline = true;break; | ||||
|       case '<i/>':  font.italic = true;break; | ||||
|       case '<strike/>':  font.strike = true;break; | ||||
|       case '<outline/>':  font.outline = true;break; | ||||
|       case '<shadow/>':  font.shadow = true;break; | ||||
| 
 | ||||
| 
 | ||||
|       case '<sz': | ||||
|         if(y.val) font.sz = y.val; | ||||
|         break; | ||||
|       case '<sz/>': case '</sz>': break; | ||||
| 
 | ||||
|       case '<vertAlign': | ||||
|         if(y.val) font.vertAlign = y.val; | ||||
|         break; | ||||
|       case '<vertAlign/>': case '</vertAlign>': break; | ||||
| 
 | ||||
| 
 | ||||
|       case '<color': | ||||
|         if (!font.color) font.color = {}; | ||||
| @ -5791,6 +5807,13 @@ if ((typeof 'module' != 'undefined'  && typeof require != 'undefined') || (typeo | ||||
|         if (attributes.bold) $font.append(XmlNode('b')); | ||||
|         if (attributes.underline)  $font.append(XmlNode('u')); | ||||
|         if (attributes.italic)  $font.append(XmlNode('i')); | ||||
|         if (attributes.strike)  $font.append(XmlNode('strike')); | ||||
|         if (attributes.outline)  $font.append(XmlNode('outline')); | ||||
|         if (attributes.shadow)  $font.append(XmlNode('shadow')); | ||||
| 
 | ||||
|         if (attributes.vertAlign) { | ||||
|           $font.append(XmlNode('vertAlign').attr('val', attributes.vertAlign)) | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         if (attributes.color) { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user