Page 1 of 1

BIFF_WriteII5.TXLSWriteII.WREC_NAME fails when Name.Ptgs=nil

Posted: Tue Feb 06, 2018 1:49 pm
by Moisha
Hi Lars.
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));
Suggest add this improvement in next revision.
Regards.
Moisha

Re: BIFF_WriteII5.TXLSWriteII.WREC_NAME fails when Name.Ptgs=nil

Posted: Wed Feb 07, 2018 11:12 am
by larsa
Hello

Please send me a file with this error.