Copy range with PasteType.NumberFormats throws NullReferenceException

Posted by: yyoshimura on 7 June 2022, 4:56 pm EST

  • Posted 7 June 2022, 4:56 pm EST

    Hi,

    We noticed that when copying range with PasteType.NumberFormats it will throw NullReferenceException. PasteType.Formats is working as expected. Please refer attachment for reproduction.

    Please help to investigate this issue. Thank you.

    Regards

    gcexcelperformance.zip
  • Replied 8 June 2022, 4:16 pm EST

    Hello,

    Thank you for reporting this issue.
    We too can observe the issue and escalate this to the development team for investigation. We will let you know as soon as we get any update on this from their end.
    [Internal Tracking ID: DOCXLS-6056]

    Regards,
    Prabhat Sharma
  • Replied 8 June 2022, 8:59 pm EST

    Hello,

    The devs have confirmed it as a bug and will fix it in the next hotfix build.

    As of now, you can use the following code before copy operation:

    for (int i = 0; i < range.FormatConditions.Count; i++)
    {
    (range.FormatConditions[i] as IFormatCondition).NumberFormat = "General";
    }


    Regards,
    Prabhat Sharma.
  • Replied 9 June 2022, 4:25 pm EST

    Thank you for your suggestion. We'll wait for the hotfix build.
  • Marked as Answer

    Replied 19 June 2022, 10:13 pm EST

    The hotfix build has been released please upgrade to the latest version to avoid this issue.
    https://www.nuget.org/packages/GrapeCity.Documents.Excel
  • Replied 21 June 2022, 11:37 am EST

    Thank you for your hotfix. We confirmed that the issue was resolved using V5.1.3.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels