You've already forked lazarus-ccr
fpspreadsheet: Fix Excel error with several images in xlsx file
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4542 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -3372,7 +3372,7 @@ begin
|
|||||||
ext := ExtractFileExt(FWorkbook.GetEmbeddedStream(img.Index).Name);
|
ext := ExtractFileExt(FWorkbook.GetEmbeddedStream(img.Index).Name);
|
||||||
AppendToStream(FSDrawingsRels[FCurSheetNum], Format(
|
AppendToStream(FSDrawingsRels[FCurSheetNum], Format(
|
||||||
' <Relationship Id="rId%d" Type="%s" Target="../media/image%d%s"/>' + LineEnding, [
|
' <Relationship Id="rId%d" Type="%s" Target="../media/image%d%s"/>' + LineEnding, [
|
||||||
img.Index+1, SCHEMAS_IMAGE, img.Index+1, ext
|
i+1, SCHEMAS_IMAGE, img.Index+1, ext
|
||||||
]));
|
]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3961,7 +3961,7 @@ end;
|
|||||||
|
|
||||||
procedure TsSpreadOOXMLWriter.WriteContentTypes;
|
procedure TsSpreadOOXMLWriter.WriteContentTypes;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i,j: Integer;
|
||||||
imgext: TStringList;
|
imgext: TStringList;
|
||||||
ext: String;
|
ext: String;
|
||||||
sheet: TsWorksheet;
|
sheet: TsWorksheet;
|
||||||
@ -3982,16 +3982,17 @@ begin
|
|||||||
begin
|
begin
|
||||||
imgExt := TStringList.Create;
|
imgExt := TStringList.Create;
|
||||||
try
|
try
|
||||||
imgExt.Duplicates := dupIgnore;
|
|
||||||
for i:=0 to Workbook.GetEmbeddedStreamCount-1 do
|
for i:=0 to Workbook.GetEmbeddedStreamCount-1 do
|
||||||
begin
|
begin
|
||||||
ext := ExtractFileExt(Workbook.GetEmbeddedStream(i).Name);
|
ext := ExtractFileExt(Workbook.GetEmbeddedStream(i).Name);
|
||||||
if ext[1] = '.' then Delete(ext, 1, 1);
|
if ext[1] = '.' then Delete(ext, 1, 1);
|
||||||
|
j := imgExt.IndexOf(ext);
|
||||||
|
if j = -1 then
|
||||||
imgExt.Add(ext);
|
imgExt.Add(ext);
|
||||||
end;
|
end;
|
||||||
for i := 0 to imgExt.Count-1 do
|
for i := 0 to imgExt.Count-1 do
|
||||||
AppendToStream(FSContentTypes, Format(
|
AppendToStream(FSContentTypes, Format(
|
||||||
'<Default Extension="%s" ContentType="image/%s" />' + LineEnding, [ext, ext]));
|
'<Default Extension="%s" ContentType="image/%s" />' + LineEnding, [imgExt[i], imgExt[i]]));
|
||||||
finally
|
finally
|
||||||
imgExt.Free;
|
imgExt.Free;
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user