Some excel feature is disabled after exporting

Posted by: cvetx on 8 September 2017, 1:52 pm EST

  • Posted 8 September 2017, 1:52 pm EST

    I can't use some feature on excel  such as, sorting, deleting, and inserting after exporting by below code. Those functions are disabled.


     Am I missing something?


     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEmpList.Click


            Me.SaveFileDialog1.Filter = "Microsoft Excel|*.xls"
            Me.SaveFileDialog1.Title = "Save as Excel"
            Me.SaveFileDialog1.FileName = "EmployeeList" & Microsoft.VisualBasic.Strings.Replace(Now.ToShortDateString, "/", "")
            Me.SaveFileDialog1.ShowDialog()



            Dim lbX As Boolean
            lbX = Me.FpSpread1.SaveExcel(Me.SaveFileDialog1.FileName, FarPoint.Win.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly)
            If lbX = True Then
                MsgBox("Export Succeeded.!")
            Else
                MsgBox("Export Failed.!")
            End If


        End Sub

  • Replied 8 September 2017, 1:52 pm EST

     


    Hello,


    By default, the exported Excel file is 'protected', preventing the features like insert/delete/sort/resize when viewed in Microsoft Excel.
    This can be overcome by either of the following:
    1) Unprotect the XLS file from the menu option of Microsoft Excel (Tools/Protection/Unprotect).
    2) Or, set the 'Protect' property of the sheet to FALSE (me.FpSpread1_Sheet1.Protect = False) and then export to Excel.


    Let me know if this resolves the problem


    Thanks,


    Deepak Sharma

  • Replied 8 September 2017, 1:52 pm EST

    You are right!.


     Thanks for the answer.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels