You've already forked lazarus-ccr
fpspreadsheet: Fix writing attributes with quotes to Excel XML files.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7992 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -48,6 +48,7 @@ function LineEndingToBR(const AText: String): String;
|
|||||||
function UTF8TextToXMLText(AText: string; ProcessLineEndings: Boolean = false): string;
|
function UTF8TextToXMLText(AText: string; ProcessLineEndings: Boolean = false): string;
|
||||||
function ValidXMLText(var AText: string; ReplaceSpecialChars: Boolean = true;
|
function ValidXMLText(var AText: string; ReplaceSpecialChars: Boolean = true;
|
||||||
ProcessLineEndings: Boolean = false): Boolean;
|
ProcessLineEndings: Boolean = false): Boolean;
|
||||||
|
function XMLQuote(AText: String): String;
|
||||||
|
|
||||||
procedure UnzipFile(AZipFileName, AZippedFile, ADestFolder: String);
|
procedure UnzipFile(AZipFileName, AZippedFile, ADestFolder: String);
|
||||||
function UnzipToStream(AZipStream: TStream; const AZippedFile: String;
|
function UnzipToStream(AZipStream: TStream; const AZippedFile: String;
|
||||||
@ -230,6 +231,15 @@ begin
|
|||||||
AText := UTF8TextToXMLText(AText, ProcessLineEndings);
|
AText := UTF8TextToXMLText(AText, ProcessLineEndings);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function XMLQuote(AText: String): String;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if AText <> '' then
|
||||||
|
Result := StringReplace(AText, '"', '"', [rfReplaceAll])
|
||||||
|
else
|
||||||
|
Result := '';
|
||||||
|
end;
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ Unzipping }
|
{ Unzipping }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
|
@ -3312,7 +3312,7 @@ begin
|
|||||||
fnt := book.GetFont(fmt^.FontIndex);
|
fnt := book.GetFont(fmt^.FontIndex);
|
||||||
s := '';
|
s := '';
|
||||||
if fnt.FontName <> deffnt.FontName then
|
if fnt.FontName <> deffnt.FontName then
|
||||||
s := s + Format('ss:FontName="%s" ', [fnt.FontName]);
|
s := s + Format('ss:FontName="%s" ', [XMLQuote(fnt.FontName)]);
|
||||||
if not SameValue(fnt.Size, deffnt.Size, 1E-3) then
|
if not SameValue(fnt.Size, deffnt.Size, 1E-3) then
|
||||||
s := s + Format('ss:Size="%g" ', [fnt.Size], FPointSeparatorSettings);
|
s := s + Format('ss:Size="%g" ', [fnt.Size], FPointSeparatorSettings);
|
||||||
if fnt.Color <> deffnt.Color then
|
if fnt.Color <> deffnt.Color then
|
||||||
@ -3337,7 +3337,7 @@ begin
|
|||||||
nfp.AllowLocalizedAMPM := false; // Replace "AMPM" by "AM/PM"
|
nfp.AllowLocalizedAMPM := false; // Replace "AMPM" by "AM/PM"
|
||||||
nfs := nfp.NumFormatStr;
|
nfs := nfp.NumFormatStr;
|
||||||
AppendToStream(AStream, Format(INDENT3 +
|
AppendToStream(AStream, Format(INDENT3 +
|
||||||
'<NumberFormat ss:Format="%s"/>' + LF, [nfs])); // Do not UTF8TextToXMLText(nfs) because of '%'
|
'<NumberFormat ss:Format="%s"/>' + LF, [XMLQuote(nfs)])); // Do not UTF8TextToXMLText(nfs) because of '%'
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Background
|
// Background
|
||||||
|
Reference in New Issue
Block a user