Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StyleXmlHelper bug #556

Closed
shishu123cn opened this issue Dec 16, 2021 · 12 comments
Closed

StyleXmlHelper bug #556

shishu123cn opened this issue Dec 16, 2021 · 12 comments

Comments

@shishu123cn
Copy link

StyleXmlHelper.cs
line 37 internal int newID = int.MinValue;

Why is int.minvalue set here?

It may cause xfsid to be negative after save。

ExcelStyle.cs
line 60 Numberformat = new ExcelNumberFormat(styles, ChangedEvent, PositionID, Address, _xfs.NumberFormatId);
_xfs maybe null。

@shishu123cn
Copy link
Author

#486
One of my previous problems finally reproduced this bug

@JanKallman
Copy link
Contributor

Can you please provide some code to reproduce your issue. Please also provide a workbook if necessary.

@shishu123cn
Copy link
Author

<cellStyleXfs count="3"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" /><xf numFmtId="0" fontId="0" fillId="0" borderId="0" /><xf numFmtId="0" fontId="2" fillId="0" borderId="0" /></cellStyleXfs>

styles.xml is like this,

ExcelStyles.cs :
private void LoadFromDocument()
{
..................................

        //cellStyleXfs
        XmlNode styleXfsNode = GetNode(CellStyleXfsPath);
        if (styleXfsNode != null)
        {
            foreach (XmlNode n in styleXfsNode)
            {
                ExcelXfs item = new ExcelXfs(_nameSpaceManager, n, this);
                CellStyleXfs.Add(item.Id, item);
            }
        }

}

ExcelXfsXml.cs :
XfId = GetXmlNodeInt("@Xfid");

When there is no @Xfid field, the default value of int.MinValue will be used, which will cause a series of problems later

@shishu123cn
Copy link
Author

XmlHelper.cs:
internal int GetXmlNodeInt(string path, int defaultValue=int.MinValue)

DefaultValue here

@JanKallman
Copy link
Contributor

This is just fragments of code. I can not reproduce the issue from this. Please provide full code and a workbook that I can test this with.

@shishu123cn
Copy link
Author

I am a company network and cannot provide you with a workbook。

@shishu123cn
Copy link
Author

You can directly modify Xfid to int.MinValue, then open and save the workbook, this problem should occur

@shishu123cn
Copy link
Author

Why is the default value here set to int.MinValue
internal int GetXmlNodeInt(string path, int defaultValue=int.MinValue)

@JanKallman
Copy link
Contributor

This is beyond the support we provide here. If you have a commercial license please provide your workbook inside our support portal.

@shishu123cn
Copy link
Author

We are a small tool for internal use, not for commercial use

@JanKallman
Copy link
Contributor

If you are a commercial company you still need a license for internal use.

@shishu123cn
Copy link
Author

Ok i got it

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

No branches or pull requests

2 participants