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

Parsing of rich text inside inline string fails #91

Closed
1omg opened this issue Nov 8, 2016 · 6 comments
Closed

Parsing of rich text inside inline string fails #91

1omg opened this issue Nov 8, 2016 · 6 comments

Comments

@1omg
Copy link

1omg commented Nov 8, 2016

Hello. Try to read xlsx file, problem with multiline cell. My code:

            var workbook = new XLWorkbook(path);
            var ws1 = workbook.Worksheet(3);
            workbook.SaveAs("tmp.xlsx");
            
            int rowCount = 20; //example
            //first row headers
            for(int i = 1 ;i<rowCount;i++)
            {
                var row = ws1.Row(i);
                IXLCell cell = row.Cell("E");     //.Cell(5); 
                bool isEmpty = cell.IsEmpty();      //always empty on this column, but in original have 6 lines
                var val = cell.Value;   //cell.
                //vals += val + Environment.NewLine;
            }

Values at file:
23b2a447f9

If i open workbook and resave it from code (.SaveAs) - values not lost. But in code (.Value , .GetString etc) it seens like empty cell.
What i do wrong?

@igitur
Copy link
Member

igitur commented Nov 8, 2016

Would you mind attaching the workbook?

@1omg
Copy link
Author

1omg commented Nov 8, 2016

tmp.xlsx
3rd worksheet / column E

@igitur
Copy link
Member

igitur commented Nov 9, 2016

I see there is a bug in ClosedXML. Your workbook contains a rare combination of rich text inside an inline string. The normal way to save an Excel file is to use shared strings. I will add a fix.

But how are you generating this workbook? Is it also programmatically?

@igitur igitur changed the title multi-line cell is read as an empty cell Parsing of rich text inside inline string fails Nov 9, 2016
@1omg
Copy link
Author

1omg commented Nov 9, 2016

Workbook generating on external services, cant change it.
When i can wait a fix? Or what I can do to fix it?

@igitur
Copy link
Member

igitur commented Nov 9, 2016

You can check my PR in #97 for the fix.

@1omg
Copy link
Author

1omg commented Nov 9, 2016

Thank you so much! I will try in the evening.

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