Spire.Spreadsheet is a powerful component to view spreadsheet. As a standalone spreadsheet class library, Spire.Spreadsheet is a companion component to Spire.XLS, which mainly focus on how to display spreadsheet.

Mon Jun 04, 2018 3:38 pm

for example, I delete a row in the sheet,now I want undo the action, how should I do? very thanks.

sff1001
 
Posts: 1
Joined: Sun Jun 07, 2015 7:22 am

Tue Jun 05, 2018 7:07 am

Dear sff1001,

Thanks for your inquiry.
Sorry that Spire.Spreadsheet doesn't support to Redo or Undo the action for deleting rows at present. We will consider adding the new feature in our future upgrade. Once there is any progress, we will let you know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 2741
Joined: Tue Sep 06, 2016 8:30 am

Wed Jun 13, 2018 3:10 am

Dear sff1001,

Thanks for your waiting.
Now the feature has been done, please download Spire.Spreadsheet Pack(hot fix) Version:2.6.0. Sample code for your reference:

Code: Select all
       private void Redo_Click(object sender, EventArgs e)
        {
            spreadsheet1.Redo();
            spreadsheet1.Refresh();
        }

        private void Undo_Click(object sender, EventArgs e)
        {
            spreadsheet1.Undo();
            spreadsheet1.Refresh();
        }

        private void btnLoadFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofDialog = new OpenFileDialog();
            ofDialog.Filter = "Microsoft Excel files(*.xls)|*.xls;*.xlsx;*.xlsb;*.ods";
            if (ofDialog.ShowDialog() == DialogResult.OK)
            {
                OpenFile(ofDialog.FileName);
            }
            spreadsheet1.EnableUndo = true;
        }
        private void OpenFile(string fileName)
        {
            if (fileName != null)
                spreadsheet1.LoadFromFile(fileName);         
        }
        private void DelRow_Click(object sender, EventArgs e)
        {
            spreadsheet1.ActiveWorksheet.RemoveRow(spreadsheet1.ActiveWorksheet.GetSelectedRange().Top);
        }
        private void DelCol_Click_1(object sender, EventArgs e)
        {
            spreadsheet1.ActiveWorksheet.RemoveColumn(spreadsheet1.ActiveWorksheet.GetSelectedRange().Right);
        }
    }

Looking forward to your feedback.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 2741
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Spreadsheet