using ExcelDna.Integration;
public class C : ESharperExt.ICommand
{
public void Run()
{
var current = XlCall.Excel(XlCall.xlfActiveCell) as ExcelReference;
for (int i = 1; i <= 5; ++i)
{
current.SetValue("Value " + i);
current = current.Offset(1, 0);
}
}
}
public static class Utilities
{
public static ExcelReference Offset(this ExcelReference range, int rows, int cols)
{
return new ExcelReference(range.RowFirst + rows, range.RowLast + rows,
range.ColumnFirst + cols, range.ColumnLast + cols, range.SheetId);
}
}
using ExcelDna.Integration;
public class C : ESharperExt.ICommand
{
public void Run()
{
var selection = XlCall.Excel(XlCall.xlfSelection) as ExcelReference;
for (int row = selection.RowFirst; row <= selection.RowLast; ++row)
for (int column = selection.ColumnFirst; column <= selection.ColumnLast; ++column)
{
var cell = new ExcelReference(row, column);
cell.SetValue("Value " + (row + 1) + "," + (column + 1));
}
}
}
public class C : ESharperExt.ICommand
{
public void Run()
{
Microsoft.Office.Interop.Excel.Application app = ExcelDna.Integration.ExcelDnaUtil.Application as
Microsoft.Office.Interop.Excel.Application;
System.Windows.MessageBox.Show(app.Name + " " + app.Version);
}
}
Copyright 2008 - 2023 Vlasov Studio (Best in class Visual Studio extensions and tools)