Do not know why it may happen, but sometimes FManager.Workbook.DefinedNames.Ptgs=nil.
May be the reason is link to non exisiting external file.
Such link is bad case but SaveToFile should not fail.
I made little improvement in my copy of source code (if (Name.Ptgs <> nil) before each use of Name.Ptgs), it does the trick.
Code: Select all
if (Name.Ptgs <> nil) and (Name.Ptgs.Id = xptg_EXCEL_97) then
Inc(Sz,Name.PtgsSz - SizeOf(TXLSPtgs))
else if (Name.Ptgs <> nil) and (Name.Ptgs.Id = xptg_ARRAYCONSTS_97) then begin
raise XLSRWException.Create('TODO Array consts 97');
end
else // Can only write areas.
Inc(Sz,1 + SizeOf(TPTGArea3d8));
Regards.
Moisha