Posted 5 August 2021, 1:57 pm EST
Hello. In our WinForms app we are using C1FlexGrid.SaveGrid to enable our users to save the grid to an Excel xlsx file. We use this syntax:
Me._queryResultsGrid.SaveGrid(saveWindow.FileName, C1.Win.C1FlexGrid.FileFormatEnum.Excel, C1.Win.C1FlexGrid.FileFlags.VisibleOnly Or C1.Win.C1FlexGrid.FileFlags.IncludeFixedCells Or C1.Win.C1FlexGrid.FileFlags.AsDisplayed Or C1.Win.C1FlexGrid.FileFlags.IncludeMergedRanges Or C1.Win.C1FlexGrid.FileFlags.LoadMergedRanges Or C1.Win.C1FlexGrid.FileFlags.OpenXml)
One user runs into this error when they try to use this function from our app:
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.SetLengthCore(Int64 value)
at C1.C1Zip.d.a()
at C1.C1Zip.d.c()
at C1.C1Zip.C1ZipFile.a(Stream A_0, String A_1, DateTime A_2)
at C1.C1Zip.C1ZipEntryCollection.Add(Stream stream, String entryName)
at C1.C1Excel.aq.a(C1ZipFile A_0)
at C1.C1Excel.aq.c(String A_0)
at C1.C1Excel.C1XLBook.a(String A_0)
at C1.Win.C1FlexGrid.Exporter.SaveGridExcel(String fileName, String sheetName, FileFlags flags, PrinterSettings ps)
at C1.Win.C1FlexGrid.Exporter.SaveGrid(String fileName, FileFormatEnum fileFormat, FileFlags flags, Encoding encoding)
at C1.Win.C1FlexGrid.Extensions.SaveGrid(C1FlexGridBase grid, String fileName, FileFormatEnum format, FileFlags flags)
at ProductVision.Windows.Forms.FormQuery.ToolStripQueryResults_SaveAs_Click(Object sender, EventArgs e) in C:\VS2015\ProductVision 5.2\Build 5.2.1005.15\ProductVision 5.0\PVClient\ProductVision.Windows.Forms\ApplicationForms\FormQuery.vb:line 14964
It doesn’t matter if they select an existing file to overwrite or setup a new file name, the error is the same. No other user gets this error, and we cannot reproduce it. From the error message, can you give us some indication of what might be the problem for this user? Something apparently has the output file locked but we cannot figure out why that would happen for this one user.
Thanks!
Tom G.