none
Read data and export to xml format current active sheet data using VSTO. RRS feed

  • Question

  • Hi All,

     Excel.Worksheet activeSheet = Globals.ThisAddIn.Application.ActiveSheet;
                var range = activeSheet.get_Range("A1", GetExcelColumnName(activeSheet.Columns.Count) + activeSheet.Rows.Count.ToString());
                range.Select();
                range.Copy();
    
                string text = Clipboard.GetText();
    
                

    private string GetExcelColumnName(int columnNumber)
            {
                int dividend = columnNumber;
                string columnName = String.Empty;
                int modulo;
    
                while (dividend > 0)
                {
                    modulo = (dividend - 1) % 26;
                    columnName = Convert.ToChar(65 + modulo).ToString() + columnName;
                    dividend = (int)((dividend - modulo) / 26);
                }
                return columnName;
            }

      The above code am using to read the data from active worksheet but some time its not working perfectly can you help me for complete this module

    Thursday, November 22, 2012 5:34 AM

All replies