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;
|
||||
if (nodename = 'definedName') or (nodename = 'x:definedName') then
|
||||
begin
|
||||
id := -1;
|
||||
sheet := nil;
|
||||
localSheetID := GetAttrValue(node, 'localSheetId');
|
||||
if (localSheetID = '') or not TryStrToInt(localSheetID, id) then
|
||||
begin
|
||||
FWorkbook.AddErrorMsg('no/invalid localID in "definedName" node');
|
||||
node := node.NextSibling;
|
||||
Continue;
|
||||
if (localSheetID <> '') then begin
|
||||
if not TryStrToInt(localSheetID, id) then
|
||||
begin
|
||||
FWorkbook.AddErrorMsg('Invalid localSheetID in "definedName" node');
|
||||
node := node.NextSibling;
|
||||
Continue;
|
||||
end;
|
||||
sheet := (FWorkbook as TsWorkbook).GetWorksheetByIndex(id);
|
||||
end;
|
||||
|
||||
namestr := GetAttrValue(node, 'name');
|
||||
sheet := (FWorkbook as TsWorkbook).GetWorksheetByIndex(id);
|
||||
if namestr = '_xlnm.Print_Area' then
|
||||
begin
|
||||
if sheet = nil then begin
|
||||
FWorkbook.AddErrorMsg('No localSheetID found for defined name "_xlnm.Print_Area"');
|
||||
continue;
|
||||
end;
|
||||
L := TStringList.Create;
|
||||
try
|
||||
L.Delimiter := ',';
|
||||
@ -1295,7 +1304,6 @@ begin
|
||||
L.DelimitedText := GetNodeValue(node);
|
||||
for j:=0 to L.Count-1 do
|
||||
begin
|
||||
//s := ReplaceStr(L[j], '''', ''); // wp: replaced by next line because of Laz 1.0
|
||||
s := StringReplace(L[j], '''', '', [rfReplaceAll]);
|
||||
p := pos(':', s);
|
||||
if p = 0 then
|
||||
@ -1313,6 +1321,10 @@ begin
|
||||
end else
|
||||
if nameStr = '_xlnm.Print_Titles' then
|
||||
begin
|
||||
if sheet = nil then begin
|
||||
FWorkbook.AddErrorMsg('No localSheetID found for defined name "_xlnm.Print_Titles"');
|
||||
continue;
|
||||
end;
|
||||
L := TStringList.Create;
|
||||
try
|
||||
L.Delimiter := ',';
|
||||
|
Reference in New Issue
Block a user