@@ -397,10 +397,12 @@ private static string ReadCellStyle(JsonElement cell)
397397 {
398398 if ( sEl . TryGetProperty ( "bold" , out var b ) && b . ValueKind == JsonValueKind . True ) style += "font-weight:bold;" ;
399399 if ( sEl . TryGetProperty ( "italic" , out var it ) && it . ValueKind == JsonValueKind . True ) style += "font-style:italic;" ;
400- if ( sEl . TryGetProperty ( "fontSize" , out var fs ) ) style += $ "font-size:{ fs . GetInt32 ( ) } px;";
401- if ( sEl . TryGetProperty ( "color" , out var cl ) ) style += $ "color:{ cl . GetString ( ) } ;";
402- if ( sEl . TryGetProperty ( "bgColor" , out var bg ) ) style += $ "background-color:{ bg . GetString ( ) } ;";
403- if ( sEl . TryGetProperty ( "align" , out var al ) ) style += $ "text-align:{ al . GetString ( ) } ;";
400+ if ( sEl . TryGetProperty ( "underline" , out var un ) && un . ValueKind == JsonValueKind . True ) style += "text-decoration:underline;" ;
401+ if ( sEl . TryGetProperty ( "fontSize" , out var fs ) && fs . ValueKind == JsonValueKind . Number ) style += $ "font-size:{ fs . GetInt32 ( ) } px;";
402+ if ( sEl . TryGetProperty ( "fontName" , out var fn ) && fn . ValueKind == JsonValueKind . String ) style += $ "font-family:{ fn . GetString ( ) } ;";
403+ if ( sEl . TryGetProperty ( "color" , out var cl ) && cl . ValueKind == JsonValueKind . String ) style += $ "color:{ cl . GetString ( ) } ;";
404+ if ( sEl . TryGetProperty ( "bgColor" , out var bg ) && bg . ValueKind == JsonValueKind . String ) style += $ "background-color:{ bg . GetString ( ) } ;";
405+ if ( sEl . TryGetProperty ( "align" , out var al ) && al . ValueKind == JsonValueKind . String ) style += $ "text-align:{ al . GetString ( ) } ;";
404406 if ( sEl . TryGetProperty ( "border" , out var bd ) && bd . ValueKind == JsonValueKind . False ) style = style . Replace ( "border:1px solid #ccc;" , "" ) ;
405407 }
406408 return style ;
@@ -460,10 +462,13 @@ private static byte[] ExportExcelCore(JsonElement root, Dictionary<string, DataT
460462 if ( cell . TryGetProperty ( "style" , out var se ) )
461463 {
462464 if ( se . TryGetProperty ( "bold" , out var b ) && b . ValueKind == JsonValueKind . True ) xlCell . Style . Font . Bold = true ;
463- if ( se . TryGetProperty ( "fontSize" , out var fs ) ) xlCell . Style . Font . FontSize = fs . GetDouble ( ) ;
464- if ( se . TryGetProperty ( "color" , out var cl ) ) xlCell . Style . Font . FontColor = XLColor . FromHtml ( cl . GetString ( ) ! ) ;
465- if ( se . TryGetProperty ( "bgColor" , out var bg ) ) xlCell . Style . Fill . BackgroundColor = XLColor . FromHtml ( bg . GetString ( ) ! ) ;
466- if ( se . TryGetProperty ( "align" , out var al ) )
465+ if ( se . TryGetProperty ( "italic" , out var it ) && it . ValueKind == JsonValueKind . True ) xlCell . Style . Font . Italic = true ;
466+ if ( se . TryGetProperty ( "underline" , out var un ) && un . ValueKind == JsonValueKind . True ) xlCell . Style . Font . Underline = XLFontUnderlineValues . Single ;
467+ if ( se . TryGetProperty ( "fontSize" , out var fs ) && fs . ValueKind == JsonValueKind . Number ) xlCell . Style . Font . FontSize = fs . GetDouble ( ) ;
468+ if ( se . TryGetProperty ( "fontName" , out var fn ) && fn . ValueKind == JsonValueKind . String ) xlCell . Style . Font . FontName = fn . GetString ( ) ! ;
469+ if ( se . TryGetProperty ( "color" , out var cl ) && cl . ValueKind == JsonValueKind . String ) xlCell . Style . Font . FontColor = XLColor . FromHtml ( cl . GetString ( ) ! ) ;
470+ if ( se . TryGetProperty ( "bgColor" , out var bg ) && bg . ValueKind == JsonValueKind . String ) xlCell . Style . Fill . BackgroundColor = XLColor . FromHtml ( bg . GetString ( ) ! ) ;
471+ if ( se . TryGetProperty ( "align" , out var al ) && al . ValueKind == JsonValueKind . String )
467472 xlCell . Style . Alignment . Horizontal = al . GetString ( ) switch
468473 {
469474 "center" => XLAlignmentHorizontalValues . Center ,
0 commit comments