Skip to content

Commit 07b61d4

Browse files
959853: Resolving Review comments
1 parent b120dc0 commit 07b61d4

1 file changed

Lines changed: 5 additions & 53 deletions

File tree

Document-Processing/Excel/Spreadsheet/Blazor/worksheet.md

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ This method inserts one or more sheets at a specified position in the workbook w
7474

7575
### Get Active Worksheet Programmatically
7676

77-
Use the [GetActiveWorksheet](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_GetActiveWorksheet) method to retrieve the currently active worksheet in the Spreadsheet component. This is particularly useful to perform operations relative to the current sheet selection. The method returns key properties of the active worksheet, such as its name, index, size (row and column counts), current active cell, and selected range. Returns null if no active worksheet is available.
77+
The [GetActiveWorksheet](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_GetActiveWorksheet) method retrieves properties of the active worksheet. This method is useful when it is necessary to obtain details about the currently active sheet. If no worksheet is active, this method returns null.
7878

7979
**Retrieve the active worksheet**
8080

81-
This approach fetches the worksheet that is currently active (selected), enabling access to its properties or performing operations programmatically (for example, reading its name or ID, or using it as a context for further actions).
81+
This method retrieves details of the currently active worksheet. Properties of the active worksheet, such as sheet name, index, or selected range, can be accessed for diagnostics, automation, or integration with other logic.
8282

8383
{% tabs %}
8484
{% highlight razor %}
@@ -108,23 +108,20 @@ This approach fetches the worksheet that is currently active (selected), enablin
108108
{% endhighlight %}
109109
{% endtabs %}
110110

111-
112-
113111
### Get Worksheet Data Programmatically
114112

115-
Use the [GetData](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_GetData_System_String_) method to retrieve data from a worksheet, either from a single cell or a specified range. This API returns key information about each cell in the given address, making it ideal for extracting and processing spreadsheet data programmatically.
113+
The [GetData](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Spreadsheet.SfSpreadsheet.html#Syncfusion_Blazor_Spreadsheet_SfSpreadsheet_GetData_System_String_) method retrieves content from the worksheet. This method provides data as a dictionary, where each entry consists of a cell address and its associated `CellData` object. The returned data includes the actual value, number format, display text, wrap and lock status, hyperlinks, and calculated style of each cell in the target area. If the specified cell address is invalid or not set, the method returns null.
116114

117115
**Retrieve cell or range data from an active worksheet**
118116

119-
This method returns a dictionary where each key is a cell's address and its value is a `CellData` object. The returned data includes the raw value, number format, display text (with formatting, if any), wrap/lock status, hyperlink (if applicable), and calculated style. If no cell address is given, or if it is invalid, the result will be null.
117+
Call this method by passing the desired cell or range as the address. For example, provide a reference such as "A1" for a single cell, "A2:B5" for a range, or "Sheet1!A2:B5" to target a range on a specific sheet. The result can be iterated to read individual cell data for further processing, logging, or custom display.
120118

121119
| Parameter | Type | Description |
122120
| :-- | :-- | :-- |
123-
| cellAddress | string | The address of the cell or range to read. Can use simple A1 (e.g., "A1"), range (e.g., "A2:B5"), or a sheet-qualified reference (e.g., "Sheet1!A2:B5"). If omitted or invalid, returns null. |
121+
| cellAddress | string | Specifies the cell or range to read. Supports addresses such as "A1", "A2:B5", or "Sheet1!A2:B5". If omitted or invalid, the return value is null. |
124122

125123
{% tabs %}
126124
{% highlight razor %}
127-
128125
@using Syncfusion.Blazor.Spreadsheet
129126

130127
<button @onclick="GetData">Get Data</button>
@@ -151,51 +148,6 @@ This method returns a dictionary where each key is a cell's address and its valu
151148
{% endhighlight %}
152149
{% endtabs %}
153150

154-
155-
156-
**Get cell or range data**
157-
158-
This method retrieves data for a single cell or a selected range, returning a dictionary where each key is a cell's address and each value is a `CellData` object. This object contains important cell properties like its raw value, number format, formatted display text (if a format is applied), wrap text status, locked status, any hyperlinks (if applicable and not a formula), and computed style. If the `cellAddress` is null or contains only whitespace, this method returns null.
159-
160-
| Parameter | Type | Description |
161-
| :-- | :-- | :-- |
162-
| cellAddress | string | Specifies the cell or range to read. Supports A1 addresses (for example, "A1"), ranges (for example, "A2:B5"), or sheet-qualified references (for example, "Sheet1!A1" or "Sheet1!A2:B5"). If a sheet name is specified, data is read from that sheet; otherwise, the active sheet is used. Null or whitespace results in no data being returned. |
163-
164-
{% tabs %}
165-
{% highlight razor %}
166-
167-
@using Syncfusion.Blazor.Spreadsheet
168-
169-
<button @onclick="GetData">Get Data</button>
170-
<SfSpreadsheet @ref=SpreadsheetInstance DataSource="DataSourceBytes">
171-
<SpreadsheetRibbon></SpreadsheetRibbon>
172-
</SfSpreadsheet>
173-
174-
@code {
175-
public byte[] DataSourceBytes { get; set; }
176-
public SfSpreadsheet SpreadsheetInstance;
177-
178-
protected override void OnInitialized()
179-
{
180-
string filePath = "wwwroot/Sample.xlsx";
181-
DataSourceBytes = File.ReadAllBytes(filePath);
182-
}
183-
184-
public async Task GetData()
185-
{
186-
// Get data for a specific range
187-
var data = SpreadsheetInstance.GetData("Sheet2!D5:E6");
188-
// You can now iterate through `data` to access individual cell information
189-
foreach (var entry in data)
190-
{
191-
Console.WriteLine($"Cell: {entry.Key}, Value: {entry.Value.Value}, DisplayText: {entry.Value.DisplayText}");
192-
}
193-
}
194-
}
195-
196-
{% endhighlight %}
197-
{% endtabs %}
198-
199151
**Insert a single sheet with a user-defined name**
200152

201153
This method adds one sheet at a specific position with a user-defined name. Each call to this method adds only one sheet. Using meaningful names like "Budget" or "Inventory" makes the workbook easier to understand. If a negative index value is provided, the method will exit without adding any sheet.

0 commit comments

Comments
 (0)