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

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
Moisha
Posts: 18
Joined: Wed Apr 06, 2016 1:00 pm

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

Post 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
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

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

Post by larsa »

Hello

Please send me a file with this error.
Lars Arvidsson, Axolot Data
Post Reply