Back to Devexpress

DocumentSettings.R1C1ReferenceStyle Property

officefileapi-devexpress-dot-spreadsheet-dot-documentsettings-dot-r1c1referencestyle.md

latest7.8 KB
Original Source

DocumentSettings.R1C1ReferenceStyle Property

Gets or sets whether the workbook uses the R1C1 reference style.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
bool R1C1ReferenceStyle { get; set; }
vb
Property R1C1ReferenceStyle As Boolean

Property Value

TypeDescription
Boolean

true , if the R1C1 reference style is turned on; otherwise, false.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to R1C1ReferenceStyle
IWorkbook

.DocumentSettings .R1C1ReferenceStyle

| | Workbook |

.DocumentSettings .R1C1ReferenceStyle

|

Remarks

The R1C1 reference style refers to both the rows and columns on the worksheet using numbers. Cell location is indicated by an “R” followed by the row number and a “C” followed by the column number. For more information, refer to Cell Referencing.

Use the following code to switch on the R1C1 reference style in a workbook loaded in the SpreadsheetControl:

csharp
spreadsheetControl1.Document.DocumentSettings.R1C1ReferenceStyle = true;
vb
spreadsheetControl1.Document.DocumentSettings.R1C1ReferenceStyle = True

Example

This example demonstrates how to create formulas using the R1C1 reference style. To do this, switch on the DocumentSettings.R1C1ReferenceStyle option and assign a formula string containing R1C1 cell references to the CellRange.Formula property. To obtain a cell reference in the R1C1 reference style, you can use the CellRange.GetReferenceR1C1 method.

View Example

csharp
// Switch on the R1C1 reference style in a workbook.
workbook.DocumentSettings.R1C1ReferenceStyle = true;

// Specify a formula with relative R1C1 references in cell D2
// to add values contained in cells A2 through A11.
worksheet.Cells["D2"].Formula = "=SUM(RC[-3]:R[9]C[-3])";

// Specify a formula with absolute R1C1 references 
// to add values contained in cells A2 through A11.
worksheet.Cells["D3"].Formula = "=SUM(R2C1:R11C1)";
vb
' Switch on the R1C1 reference style in a workbook.
workbook.DocumentSettings.R1C1ReferenceStyle = True

' Specify a formula with relative R1C1 references in cell D2
' to add values contained in cells A2 through A11.
worksheet.Cells("D2").Formula = "=SUM(RC[-3]:R[9]C[-3])"

' Specify a formula with absolute R1C1 references 
' to add values contained in cells A2 through A11.
worksheet.Cells("D3").Formula = "=SUM(R2C1:R11C1)"

The following code snippets (auto-collected from DevExpress Examples) contain references to the R1C1ReferenceStyle property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-spreadsheet-use-formula-engine/CS/FormulaEngineTest/Form1.cs#L21

csharp
ribbonControl1.SelectedPage = formulaEngineRibbonPage1;
spreadsheetControl1.Document.DocumentSettings.R1C1ReferenceStyle = true;
editExpressionStyle.EditValue = 0;

winforms-spreadsheetcontrol-api-part1/CS/SpreadsheetControl/SpreadsheetActions/FormulaActions.cs#L71

csharp
// Switch on the R1C1 reference style in a workbook.
workbook.DocumentSettings.R1C1ReferenceStyle = true;

wpf-spreadsheetcontrol-api-part-1/CS/SpreadsheetControl_WPF_API/SpreadsheetActions/FormulaActions.cs#L71

csharp
// Switch on the R1C1 reference style in a workbook.
workbook.DocumentSettings.R1C1ReferenceStyle = true;

spreadsheet-document-api-examples-part1/CS/SpreadsheetExamples/SpreadsheetActions/FormulaActions.cs#L59

csharp
// Switch on the R1C1 reference style in a workbook.
workbook.DocumentSettings.R1C1ReferenceStyle = true;

winforms-spreadsheet-use-formula-engine/VB/FormulaEngineTest/Form1.vb#L20

vb
ribbonControl1.SelectedPage = formulaEngineRibbonPage1
spreadsheetControl1.Document.DocumentSettings.R1C1ReferenceStyle = True
editExpressionStyle.EditValue = 0

winforms-spreadsheetcontrol-api-part1/VB/SpreadsheetControl/SpreadsheetActions/FormulaActions.vb#L64

vb
' Switch on the R1C1 reference style in a workbook.
workbook.DocumentSettings.R1C1ReferenceStyle = True

wpf-spreadsheetcontrol-api-part-1/VB/SpreadsheetControl_WPF_API/SpreadsheetActions/FormulaActions.vb#L66

vb
' Switch on the R1C1 reference style in a workbook.
workbook.DocumentSettings.R1C1ReferenceStyle = True

spreadsheet-document-api-examples-part1/VB/SpreadsheetExamples/SpreadsheetActions/FormulaActions.vb#L53

vb
' Switch on the R1C1 reference style in a workbook.
workbook.DocumentSettings.R1C1ReferenceStyle = True
' Specify a formula with relative R1C1 references in the "D2" cell

See Also

DocumentSettings Interface

DocumentSettings Members

DevExpress.Spreadsheet Namespace