You've already forked lazarus-ccr
fpspreadsheet: Less stringent requirements for presence of localSheetID attributes for names ranges in xlsx files. Issue #34381.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6858 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1277,17 +1277,26 @@ begin
|
|||||||
nodename := node.NodeName;
|
nodename := node.NodeName;
|
||||||
if (nodename = 'definedName') or (nodename = 'x:definedName') then
|
if (nodename = 'definedName') or (nodename = 'x:definedName') then
|
||||||
begin
|
begin
|
||||||
|
id := -1;
|
||||||
|
sheet := nil;
|
||||||
localSheetID := GetAttrValue(node, 'localSheetId');
|
localSheetID := GetAttrValue(node, 'localSheetId');
|
||||||
if (localSheetID = '') or not TryStrToInt(localSheetID, id) then
|
if (localSheetID <> '') then begin
|
||||||
|
if not TryStrToInt(localSheetID, id) then
|
||||||
begin
|
begin
|
||||||
FWorkbook.AddErrorMsg('no/invalid localID in "definedName" node');
|
FWorkbook.AddErrorMsg('Invalid localSheetID in "definedName" node');
|
||||||
node := node.NextSibling;
|
node := node.NextSibling;
|
||||||
Continue;
|
Continue;
|
||||||
end;
|
end;
|
||||||
namestr := GetAttrValue(node, 'name');
|
|
||||||
sheet := (FWorkbook as TsWorkbook).GetWorksheetByIndex(id);
|
sheet := (FWorkbook as TsWorkbook).GetWorksheetByIndex(id);
|
||||||
|
end;
|
||||||
|
|
||||||
|
namestr := GetAttrValue(node, 'name');
|
||||||
if namestr = '_xlnm.Print_Area' then
|
if namestr = '_xlnm.Print_Area' then
|
||||||
begin
|
begin
|
||||||
|
if sheet = nil then begin
|
||||||
|
FWorkbook.AddErrorMsg('No localSheetID found for defined name "_xlnm.Print_Area"');
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
L := TStringList.Create;
|
L := TStringList.Create;
|
||||||
try
|
try
|
||||||
L.Delimiter := ',';
|
L.Delimiter := ',';
|
||||||
@ -1295,7 +1304,6 @@ begin
|
|||||||
L.DelimitedText := GetNodeValue(node);
|
L.DelimitedText := GetNodeValue(node);
|
||||||
for j:=0 to L.Count-1 do
|
for j:=0 to L.Count-1 do
|
||||||
begin
|
begin
|
||||||
//s := ReplaceStr(L[j], '''', ''); // wp: replaced by next line because of Laz 1.0
|
|
||||||
s := StringReplace(L[j], '''', '', [rfReplaceAll]);
|
s := StringReplace(L[j], '''', '', [rfReplaceAll]);
|
||||||
p := pos(':', s);
|
p := pos(':', s);
|
||||||
if p = 0 then
|
if p = 0 then
|
||||||
@ -1313,6 +1321,10 @@ begin
|
|||||||
end else
|
end else
|
||||||
if nameStr = '_xlnm.Print_Titles' then
|
if nameStr = '_xlnm.Print_Titles' then
|
||||||
begin
|
begin
|
||||||
|
if sheet = nil then begin
|
||||||
|
FWorkbook.AddErrorMsg('No localSheetID found for defined name "_xlnm.Print_Titles"');
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
L := TStringList.Create;
|
L := TStringList.Create;
|
||||||
try
|
try
|
||||||
L.Delimiter := ',';
|
L.Delimiter := ',';
|
||||||
|
Reference in New Issue
Block a user