Skip to content
This repository has been archived by the owner on Mar 9, 2020. It is now read-only.

_color being null if border tag is empty #463

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hassoon3
Copy link

Hi,

In a generated excel file by a DevExpress library, there might be some border tags in the style that have no content. Reading like this (intended tag in bold):

    <borders count="2">
        **<border />**
        <border>
            <left/>
            <right/>
            <top/>
            <bottom style="thin">
                <color indexed="64"/>
            </bottom>
            <diagonal/>
        </border>
    </borders>

In which case an NullReferenceException will be thrown when accessing _color.Copy()

The recommended and tested solution is to check for the Exists property before trying to copy the color.

I am sorry for not including a Unit Test, as I am still not so fluent in writing them in .Net

Regards,

Hi,

In a DevExpress generated excel file, there might be border tags in the style that have no content. Reading like this:
<border />

In which case an exception will be thrown.

The solution is to check for the Exists property before trying to copy the color.

Regards,
@supertx2
Copy link

This, and adding a question mark on get Id in ExcelBorderItemXml.cs will solve my issue with telerik Reporting, #524
image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants