diff --git a/components/fpspreadsheet/fpshtmlutils.pas b/components/fpspreadsheet/fpshtmlutils.pas index 48de0e342..12a20f1b6 100644 --- a/components/fpspreadsheet/fpshtmlutils.pas +++ b/components/fpspreadsheet/fpshtmlutils.pas @@ -988,47 +988,54 @@ begin // NOTE: This is a simple version: every opened tag is closed afterwards! // In a more advanced version, shared properties should be kept. This is // what FChangedParams was introduced for! - if [cfFontName, cfFontSize, cfFontColor] * FChangedparams[i] <> [] then + if not SameFont(FBaseFont, FFonts[i]) then begin - Result := Result + ''; - if (cfItalic in FChangedParams[i]) then - Result := Result + ''; - if (cfUnderline in FChangedParams[i]) then - Result := Result + ''; - if (cfStrikeout in FChangedParams[i]) then - Result := Result + ''; - if (cfFontPosition in FChangedParams[i]) then - begin - if FFonts[i].Position = fpSuperscript then Result := Result + ''; - if FFonts[i].Position = fpSubscript then Result := Result + ''; + if [cfFontName, cfFontSize, cfFontColor] * FChangedparams[i] <> [] then + begin + Result := Result + ''; + end; + if (cfBold in FChangedParams[i]) then + Result := Result + ''; + if (cfItalic in FChangedParams[i]) then + Result := Result + ''; + if (cfUnderline in FChangedParams[i]) then + Result := Result + ''; + if (cfStrikeout in FChangedParams[i]) then + Result := Result + ''; + if (cfFontPosition in FChangedParams[i]) then + begin + if FFonts[i].Position = fpSuperscript then Result := Result + ''; + if FFonts[i].Position = fpSubscript then Result := Result + ''; + end; end; // Add the node text Result := Result + GetTextOfRichTextParam(i); // Add closing tags (reverse order as opening!) - if (cfFontPosition in FChangedParams[i]) then + if not SameFont(FBaseFont, FFonts[i]) then begin - if FFonts[i].Position = fpSubscript then Result := Result + ''; - if FFonts[i].Position = fpSuperscript then Result := Result + ''; + if (cfFontPosition in FChangedParams[i]) then + begin + if FFonts[i].Position = fpSubscript then Result := Result + ''; + if FFonts[i].Position = fpSuperscript then Result := Result + ''; + end; + if (cfStrikeout in FChangedParams[i]) then + Result := Result + ''; + if (cfUnderline in FChangedParams[i]) then + Result := Result + ''; + if (cfItalic in FChangedParams[i]) then + Result := Result + ''; + if (cfBold in FChangedParams[i]) then + Result := Result + ''; + if [cfFontName, cfFontSize, cfFontColor] * FChangedParams[i] <> [] then + Result := Result + ''; end; - if (cfStrikeout in FChangedParams[i]) then - Result := Result + ''; - if (cfUnderline in FChangedParams[i]) then - Result := Result + ''; - if (cfItalic in FChangedParams[i]) then - Result := Result + ''; - if (cfBold in FChangedParams[i]) then - Result := Result + ''; - if [cfFontName, cfFontSize, cfFontColor] * FChangedParams[i] <> [] then - Result := Result + '