• Question

  • Hi,

    I was trying to develop excel plugin. I am using LIST Object.

    What i found is after Binding the data into list object undo doesn't work.

    Is there any solutions to work around this.

    Any help would be appreciated.


    K K Sanghi
    Wednesday, February 1, 2012 6:54 PM

All replies

  • Hi K,


    Thanks for posting in the MSDN Forum.


    I’m hardly to say “Why” about your issue. I think it will make more sense if you can provide more detailed description for your issue. I noticed the thread http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/e2705475-f584-44da-a9b7-90090fb2414b. I think these a same issue is it right. If it is, I’m confused with the statement “ What I found is after Binging the data into list object undo doesn’t work”. What happened on your side? It doesn’t seem truncate the integer value on your workbook.


    I suppose what you want to express is you ListObject can’t show all of your integer value in it, it just show a part of it. Is it right?


    I will provide you a simple snippet to create a ListObject on the worksheet, I used Official code in it. You can also find it at http://msdn.microsoft.com/en-us/library/eyfs6478.aspx. I’m wondering your snippet to binding Datasource to the ListObject too.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Office.Tools.Ribbon;
    using Excel = Microsoft.Office.Interop.Excel;
    using System.Windows.Forms;
    using Microsoft.Office.Tools.Excel;
    namespace ExcelAddIn1
        public partial class Ribbon1
            private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
            private void button1_Click(object sender, RibbonControlEventArgs e)
                Excel.Application objApplication = Globals.ThisAddIn.Application;
                Excel.Workbook objWorkbook = objApplication.ActiveWorkbook;
                Excel.Worksheet objWorksheet = objWorkbook.ActiveSheet;
                List<int> source = new List<int>();
                for (int i = 1; i < 21; i++)
                    objWorksheet.Cells[i+1, 1].Value = i;
                Worksheet VSTOWorkSheet = Globals.Factory
                VSTOWorkSheet.Controls.AddListObject(objWorksheet.Range["A1", "A21"]
                    , "Test ListObject").HeaderRowRange.Value = "Test";


    Have a good day,


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Friday, February 3, 2012 3:56 AM
  • Hi Tom,

    In the above post i am not talking about the truncation of the integer.

    My actual problem is when we have a list object and we bind the list object with a data source in that case after doing any modification in the list(data) UNDO (CTR+Z) does not work.


    But i am surprised when i used below statement


    then after on wards UNDO (CTR+Z) is working.

    Kindly guide me how to solve this issue.

    Environment Details : Excel 2007/2010

    Run time version: 3.5 VS2008

    K K Sanghi
    Friday, February 3, 2012 5:07 AM