Skip to content

Commit 38e827c

Browse files
committed
HTML fixes
1 parent 2d8bb79 commit 38e827c

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

docs/how-to-retrieve-a-dictionary-of-all-named-ranges-in-a-spreadsheet.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ The code starts by creating a variable named **returnValue** that the method wil
112112
Return returnValue
113113
```
114114

115-
The code continues by opening the spreadsheet document, using the <span sdata="cer"
116-
target="M:DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(System.String,System.Boolean)">**Open**</span> method and indicating that the
117-
document should be open for read-only access (the final false parameter). Given the open workbook, the code uses the <span sdata="cer" target="P:DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.WorkbookPart">**WorkbookPart**</span> property to navigate to the main workbook part. The code stores this reference in a variable named **wbPart**.
115+
The code continues by opening the spreadsheet document, using the **Open** method and indicating that the
116+
document should be open for read-only access (the final false parameter). Given the open workbook, the code uses the **WorkbookPart** property to navigate to the main workbook part. The code stores this reference in a variable named **wbPart**.
118117

119118
```csharp
120119
// Open the spreadsheet document for read-only access.
@@ -141,7 +140,7 @@ document should be open for read-only access (the final false parameter). Given
141140
## Retrieving the Defined Names
142141

143142
Given the workbook part, the next step is simple. The code uses the
144-
<span sdata="cer" target="P:DocumentFormat.OpenXml.Packaging.WorkbookPart.Workbook">**Workbook**</span> property of the workbook part to retrieve a reference to the content of the workbook, and then retrieves the <span sdata="cer" target="P:DocumentFormat.OpenXml.Spreadsheet.Workbook.DefinedNames">**DefinedNames**</span> collection provided by the Open XML SDK 2.5. This property returns a collection of all of the
143+
**Workbook** property of the workbook part to retrieve a reference to the content of the workbook, and then retrieves the **DefinedNames** collection provided by the Open XML SDK 2.5. This property returns a collection of all of the
145144
defined names that are contained within the workbook. If the property returns a non-null value, the code then iterates through the collection, retrieving information about each named part and adding the key name) and value (range description) to the dictionary for each defined name.
146145

147146
```csharp

docs/how-to-retrieve-a-list-of-the-hidden-worksheets-in-a-spreadsheet.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ You can use the **GetHiddenSheets** method, which is shown in the following code
5050
Public Function GetHiddenSheets(ByVal fileName As String) As List(Of Sheet)
5151
```
5252

53-
The method works with the workbook you specify, filling a <span sdata="cer" target="T:System.Collections.Generic.List`1">**[List\<T\>](https://msdn2.microsoft.com/library/6sh2ey19)** instance with a reference to each hidden <span sdata="cer" target="T:DocumentFormat.OpenXml.Spreadsheet.Sheet">**Sheet**</span> object.
53+
The method works with the workbook you specify, filling a **[List\<T\>](https://msdn2.microsoft.com/library/6sh2ey19)** instance with a reference to each hidden **Sheet** object.
5454

5555
## Calling the GetHiddenSheets method
5656

@@ -89,7 +89,7 @@ The following code starts by creating a generic list that will contain informati
8989
Dim returnVal As New List(Of Sheet)
9090
```
9191

92-
Next, the following code opens the specified workbook by using the <span sdata="cer" target="M:DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(System.String,System.Boolean)">**SpreadsheetDocument.Open**</span> method and indicating that the document should be open for read-only access (the final **false** parameter value). Given the open workbook, the code uses the <span sdata="cer" target="P:DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.WorkbookPart">**WorkbookPart**</span> property to navigate to the main workbook part, storing the reference in a variable named **wbPart**.
92+
Next, the following code opens the specified workbook by using the **SpreadsheetDocument.Open** method and indicating that the document should be open for read-only access (the final **false** parameter value). Given the open workbook, the code uses the **WorkbookPart** property to navigate to the main workbook part, storing the reference in a variable named **wbPart**.
9393

9494
```csharp
9595
using (SpreadsheetDocument document =
@@ -111,8 +111,8 @@ Next, the following code opens the specified workbook by using the <span sdata="
111111

112112
## Retrieve the collection of worksheets
113113

114-
The <span sdata="cer" target="T:DocumentFormat.OpenXml.Packaging.WorkbookPart">**WorkbookPart**</span> class provides a <span sdata="cer" target="P:DocumentFormat.OpenXml.Packaging.WorkbookPart.Workbook">**Workbook**</span> property, which in turn contains the XML content of the workbook. Although the Open XML SDK 2.5 provides the <span sdata="cer" target="P:DocumentFormat.OpenXml.Spreadsheet.Workbook.Sheets">**Sheets**</span> property, which returns a collection of the **Sheet** parts, all the information that you need is provided by the **Sheet** elements within the **Workbook** XML content.
115-
The following code uses the <span sdata="cer" target="M:DocumentFormat.OpenXml.OpenXmlElement.Descendants``1">**Descendants**</span> generic method of the **Workbook** object to retrieve a collection of **Sheet** objects that contain information about all the sheet child elements of the workbook's XML content.
114+
The **WorkbookPart** class provides a **Workbook** property, which in turn contains the XML content of the workbook. Although the Open XML SDK 2.5 provides the **Sheets** property, which returns a collection of the **Sheet** parts, all the information that you need is provided by the **Sheet** elements within the **Workbook** XML content.
115+
The following code uses the **Descendants** generic method of the **Workbook** object to retrieve a collection of **Sheet** objects that contain information about all the sheet child elements of the workbook's XML content.
116116

117117
```csharp
118118
var sheets = wbPart.Workbook.Descendants<Sheet>();
@@ -125,9 +125,9 @@ The following code uses the <span sdata="cer" target="M:DocumentFormat.OpenXml.O
125125
## Retrieve hidden sheets
126126

127127
It's important to be aware that Excel supports two levels of worksheets. You can hide a worksheet by using the Excel user interface by right-clicking the worksheets tab and opting to hide the worksheet.
128-
For these worksheets, the <span sdata="cer" target="P:DocumentFormat.OpenXml.Spreadsheet.Sheet.State">**State**</span> property of the **Sheet** object contains an enumerated value of <span sdata="cer" target="F:DocumentFormat.OpenXml.Spreadsheet.SheetStateValues.Hidden">**Hidden**</span>. You can also make a worksheet very hidden by writing code (either in VBA or in another language) that sets the sheet's **Visible** property to the enumerated value **xlSheetVeryHidden**. For worksheets hidden in this manner, the **State** property of the **Sheet** object contains the enumerated value <span sdata="cer" target="F:DocumentFormat.OpenXml.Spreadsheet.SheetStateValues.VeryHidden">**VeryHidden**</span>.
128+
For these worksheets, the **State** property of the **Sheet** object contains an enumerated value of **Hidden**. You can also make a worksheet very hidden by writing code (either in VBA or in another language) that sets the sheet's **Visible** property to the enumerated value **xlSheetVeryHidden**. For worksheets hidden in this manner, the **State** property of the **Sheet** object contains the enumerated value **VeryHidden**.
129129

130-
Given the collection that contains information about all the sheets, the following code uses the <span sdata="cer" target="M:System.Linq.Enumerable.Where``1(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Int32,System.Boolean})">**[Where](https://msdn2.microsoft.com/library/bb301979)**</span> function to filter the collection so that it contains only the sheets in which the **State** property is not null. If the **State** property is not null, the code looks for the **Sheet** objects in which the **State** property as a value, and where the value is either **SheetStateValues.Hidden** or **SheetStateValues.VeryHidden**.
130+
Given the collection that contains information about all the sheets, the following code uses the **[Where](https://msdn2.microsoft.com/library/bb301979)** function to filter the collection so that it contains only the sheets in which the **State** property is not null. If the **State** property is not null, the code looks for the **Sheet** objects in which the **State** property as a value, and where the value is either **SheetStateValues.Hidden** or **SheetStateValues.VeryHidden**.
131131

132132
```csharp
133133
var hiddenSheets = sheets.Where((item) => item.State != null &&
@@ -143,7 +143,7 @@ Given the collection that contains information about all the sheets, the followi
143143
item.State.Value = SheetStateValues.VeryHidden))
144144
```
145145

146-
Finally, the following code calls the <span sdata="cer" target="M:System.Linq.Enumerable.ToList``1(System.Collections.Generic.IEnumerable{``0})">**[ToList\<TSource\>](https://msdn2.microsoft.com/library/bb342261)**</span> method to execute the LINQ query that retrieves the list of hidden sheets, placing the result into the return value for the function.
146+
Finally, the following code calls the **[ToList\<TSource\>](https://msdn2.microsoft.com/library/bb342261)** method to execute the LINQ query that retrieves the list of hidden sheets, placing the result into the return value for the function.
147147

148148
```csharp
149149
returnVal = hiddenSheets.ToList();

0 commit comments

Comments
 (0)