//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); // Get the cell at row 0, column 0 in the worksheet named "Sheet1" var mc = workbook.Worksheets["Sheet1"].Cells[0, 0]; // Print the absolute address of the cell (e.g., $A$1) Console.WriteLine(mc.Address); // Print the address of the cell with the row not being absolute (e.g., $A1) Console.WriteLine(mc.GetAddress(rowAbsolute: false)); // Print the address of the cell in R1C1 reference style (e.g., R1C1) Console.WriteLine(mc.GetAddress(referenceStyle: ReferenceStyle.R1C1)); // Print the address of the cell in R1C1 reference style with both row and column not being absolute, // relative to the cell at row 2, column 2 in the first worksheet (e.g., R[-2]C[-2]) Console.WriteLine(mc.GetAddress(referenceStyle: ReferenceStyle.R1C1, rowAbsolute: false, columnAbsolute: false, relativeTo: workbook.Worksheets[0].Cells[2, 2]));
' Create a new Workbook Dim workbook As New Workbook ' Get the cell at row 0, column 0 in the worksheet named "Sheet1" Dim mc = workbook.Worksheets!Sheet1.Cells(0, 0) ' Print the absolute address of the cell (e.g., $A$1) Console.WriteLine(mc.Address) ' Print the address of the cell with the row not being absolute (e.g., $A1) Console.WriteLine(mc.GetAddress(rowAbsolute:=False)) ' Print the address of the cell in R1C1 reference style (e.g., R1C1) Console.WriteLine(mc.GetAddress(referenceStyle:=ReferenceStyle.R1C1)) ' Print the address of the cell in R1C1 reference style with both row and column not being absolute, ' relative to the cell at row 2, column 2 in the first worksheet (e.g., R[-2]C[-2]) Console.WriteLine(mc.GetAddress(referenceStyle:=ReferenceStyle.R1C1, rowAbsolute:=False, columnAbsolute:=False, relativeTo:=workbook.Worksheets(0).Cells(2, 2)))