Unfreez column header

Posted by: xucaen on 8 September 2017, 2:22 pm EST

  • Posted 8 September 2017, 2:22 pm EST

    When I export a spread to Excel, the column header is always frozen. Is there a way to unfreez it? I tried setting FrozenColumnCount, FrozenRowCount, FrozenTrailingColumnCount, and FrozenTrailingRowCount all to zero.


     


    Thanks, 

  • Replied 8 September 2017, 2:22 pm EST

    Hello,

    You need to make sure that the exported spread sheet is not Protected if it is you need to Unprotect it.

    Tools-> Protection->Unprotect Sheet.

    You may also set spread sheet's  Protect Property to false in order to export the unprotected sheet.

    FpSpread1.ActiveSheet.Protect = False

    FpSpread1.SaveExcel( )

     

    Thanks,

     

     

  • Replied 8 September 2017, 2:22 pm EST

    Hi, I set the ActiveSheet.Protect = false, but I still get a frozen column header at the top of the Excel file. I wonder if there is something else I need to do in code to get it to become unfrozen?


     


    Thanks,

  • Replied 8 September 2017, 2:22 pm EST

    Hello,


    Are you talking about the Excel's default ColumnHeader( A, B, C, or 1,2,3) or the Spread's ColumnHeader after being exported to Excel?


    Thanks.

  • Replied 8 September 2017, 2:22 pm EST

    Spread's ColumnHeader after being exported to Excel.
  • Replied 8 September 2017, 2:22 pm EST

    Hello,


    We are unable to replicate the issue at our end using ActiveSheet's Protect property set to false even if cells in columnHeader are locked, we are not getting spread's ColumnHeader after being exported to Excel as unprotected and we are able to edit it in Excel.


    Please have a look at the code and let us know the steps to replicate the issue along with the version of Spread you are using?



     private void Form1_Load(object sender, EventArgs e)
            {
                fpSpread1.ActiveSheet.Protect = false;
                // even if cells are locked, on setting protection to false.. headers are not locked.
                fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 0, 0, fpSpread1.ActiveSheet.Columns.Count - 1].Locked = true;
                fpSpread1.ActiveSheet.Cells[1, 1].Text = "Text in cells";
                fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 0].Text = "ColumnHeader";
            }


            private void Save_Click(object sender, EventArgs e)
            {
                fpSpread1.SaveExcel(@"D:\Column_header.xls", FarPoint.Win.Spread.Model.IncludeHeaders.BothCustomOnly);
            }


    Thanks.

Need extra support?

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

Learn More

Forum Channels