Hi,
I have stripped our use down to be a very simple data-dump.
Row 1 = column headers
Rows 2 to N = data
I am using the auto filtering feature
sheet.Filter.FilterRange = sheet.UsedCellRange;
once all the data has been written
File is being saved
IWorkbookFormatProvider XSLXwriter = new XlsxFormatProvider();
using (FileStream filestream = new FileStream(filename, FileMode.Create))
XSLXwriter.Export(output, filestream);
Output is a Workbook and filename is a unique string.
I am simulating a user experience of wanting to us the sorting options provided within Excel however this causes a crash and the file to be recovered. Saving and re-opening fixes this problem. Comparing workbook.xml from the before(which crashes) and after(save as copy) it looks like this is missing.
<definedNames>
<definedName name="_xlnm._FilterDatabase" localSheetId="0" hidden="1">Sheet1!$A$1:$GJ$531</definedName>
</definedNames>
<calcPr calcId="0"/>
If you could advise on solving this issue it would be great.
Many Thanks
6 Answers, 1 is accepted
I have tried to reproduce the issue, but with no success. I am attaching the sample project I have used to test your case. Please try in on your side and modify it so the issue can be reproduced and send it back to us to investigate and fix it.
Regards,
Nikolay Demirev
Telerik
Hi Nikolay,
Thank you for the quick response. Unfortunately I have not been able to diagnose the issue using the sample project.
Making 0 modifications to the project myself I am able to replicate the issue.
Opening the project with
Microsoft Visual Studio Professions 2012, Version 11.0.61219.00 update 5
Microsoft .Net Framework version 4.6.01038
Microsoft Excel 2013, Version 15.0.4823.1002
Step by Step breakdown of how I have replicated the issue.
1. Run project and save file as file.XLSX
2. Open file in Excel
3. Attempt to sort any column which causes an error.
Opening the XLSX file and attempting to sort recovers the file. Looking at this in more detail it seems that Saving and Opening is not the fix rather removing and reapplying the filters. Please find below a copy of the XML from XLSX file produced as well as a copy after removing and reapplying filters.
XML Before
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
workbook
xmlns:r
=
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns
=
"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
>
<
sheets
>
<
sheet
sheetId
=
"1"
name
=
"Sheet1"
state
=
"visible"
r:id
=
"rId4"
/>
</
sheets
>
</
workbook
>
XML After
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
standalone
=
"yes"
?>
<
workbook
xmlns
=
"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
xmlns:r
=
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:mc
=
"http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable
=
"x15"
xmlns:x15
=
"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"
>
<
fileVersion
appName
=
"xl"
lastEdited
=
"6"
lowestEdited
=
"6"
rupBuild
=
"14420"
/><
workbookPr
/>
<
mc:AlternateContent
xmlns:mc
=
"http://schemas.openxmlformats.org/markup-compatibility/2006"
>
<
mc:Choice
Requires
=
"x15"
><
x15ac:absPath
url
=
"C:\Users\ryan\Desktop\New folder (2)\"
xmlns:x15ac
=
"http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"
/>
</
mc:Choice
>
</
mc:AlternateContent
>
<
bookViews
>
<
workbookView
xWindow
=
"0"
yWindow
=
"0"
windowWidth
=
"25125"
windowHeight
=
"13620"
/>
</
bookViews
>
<
sheets
>
<
sheet
name
=
"Sheet1"
sheetId
=
"1"
r:id
=
"rId1"
/>
</
sheets
>
<
definedNames
>
<
definedName
name
=
"_xlnm._FilterDatabase"
localSheetId
=
"0"
hidden
=
"1"
>Sheet1!$A$1:$AX$1</
definedName
>
</
definedNames
>
<
calcPr
calcId
=
"0"
/>
</
workbook
>
Hopefully we can work to resolve this issue.
Many thanks
I am afraid that still we're unable to reproduce the reported behavior. I have attached a short video showing how it works at our side. Can you take a look at it and let me know if I'm missing anything?
Also can you please confirm that you're using the latest R2 2016 release of UI for WinForms?
Looking forward to your reply.
Regards,
Yana
Telerik
The issue is with the sorting of data in excel when filters are applied not filtering the data. Please find attached a GIF showing how I replicated the problem.
UI for WinForms Q1 2016 SP1 (version 2016.1.216) is the version we are using.
If you need any additional information just ask.
Thanks
I have been able to reproduce the issue and I have logged public item in our Feedback Portal where you can track the process on the matter.
Regards,
Nikolay Demirev
Telerik