Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract snippets #313

Closed
wants to merge 56 commits into from
Closed
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
455e776
closes #231
mikeebowen Feb 5, 2024
00a87e6
closes #230
mikeebowen Feb 5, 2024
2561802
Merge remote-tracking branch 'upstream/main' into extract-snippets-2
mikeebowen Feb 6, 2024
a1b162c
closes #219
mikeebowen Feb 6, 2024
3368d85
closes #218
mikeebowen Feb 7, 2024
5f30e91
closes #310
mikeebowen Feb 8, 2024
37c5abd
closes #217
mikeebowen Feb 8, 2024
428e4e4
closes #216
mikeebowen Feb 8, 2024
b2fc6f1
closes #215
mikeebowen Feb 9, 2024
367e934
closes #214
mikeebowen Feb 9, 2024
a37abb3
closes #213
mikeebowen Feb 13, 2024
a887549
closes #212
mikeebowen May 13, 2024
bb1f634
closes #211
mikeebowen May 13, 2024
1d5930b
closes #210
mikeebowen May 13, 2024
59fb086
closes #209
mikeebowen May 13, 2024
c1de6cb
closes #208
mikeebowen May 14, 2024
0cf5f64
closes #207
mikeebowen Sep 10, 2024
5b493ed
closes #206
mikeebowen Sep 12, 2024
4b78beb
closes #205
mikeebowen Sep 12, 2024
5764348
closes #314
mikeebowen Sep 17, 2024
d8f386a
closes #204
mikeebowen Sep 18, 2024
8be3137
closes #203
mikeebowen Sep 19, 2024
25963a6
closes #202
mikeebowen Sep 19, 2024
9dc2934
closes #201
mikeebowen Sep 20, 2024
a9d0927
closes #200
mikeebowen Nov 21, 2024
a97d9e4
update SDK version
mikeebowen Nov 21, 2024
c2bb069
fix xref errors
mikeebowen Nov 21, 2024
f51f3f7
add missing heading
mikeebowen Nov 21, 2024
2359790
closes #199
mikeebowen Nov 26, 2024
7d6e92b
closes #198
mikeebowen Nov 26, 2024
1b53a54
fix xref errors
mikeebowen Nov 26, 2024
56ffe22
closes #197
mikeebowen Nov 26, 2024
4125a27
closes #196
mikeebowen Nov 26, 2024
545b059
fix tab names
mikeebowen Nov 27, 2024
2236858
fix tab names
mikeebowen Nov 27, 2024
4346e18
closes #194
mikeebowen Nov 27, 2024
36b0ede
closes #193
mikeebowen Nov 27, 2024
42e00d2
update using-statement.md
mikeebowen Dec 3, 2024
b7fa8ef
update using-statement.md file location
mikeebowen Dec 3, 2024
0cd3853
re-add using-statement.md to fix errors. Will be removed in a later PR
mikeebowen Dec 3, 2024
80c463d
revert changes to presentation folder
mikeebowen Dec 3, 2024
6003c8b
closes #192
mikeebowen Dec 2, 2024
73f318b
closes #191
mikeebowen Dec 3, 2024
3ca422c
fixes #190
mikeebowen Dec 3, 2024
f8662ec
move using paragraph into separate file
mikeebowen Dec 3, 2024
1624302
closes #189
mikeebowen Dec 4, 2024
bd191aa
closes #188
mikeebowen Dec 4, 2024
ea176fd
closes #187
mikeebowen Dec 6, 2024
795c6c7
closes #186
mikeebowen Dec 6, 2024
3c0aa1b
- closes #185
mikeebowen Dec 31, 2024
28c1ce3
closes #184
mikeebowen Dec 31, 2024
f93643f
closes #183
mikeebowen Dec 31, 2024
000770d
closes #182
mikeebowen Jan 2, 2025
8aee71b
closes #180
mikeebowen Jan 3, 2025
1ab1dfb
fix merge conflict
mikeebowen Jan 3, 2025
908ac45
Merge branch 'main' into extract-snippets
lindalu-MSFT Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/general/how-to-add-a-new-document-part-to-a-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ The code starts with opening a package file by passing a file name to one of the
***


The **using** statement provides a recommended alternative to the typical .Create, .Save, .Close sequence. It ensures that the **Dispose** method (internal method used by the Open XML SDK to clean up resources) is automatically called when the closing brace is reached. The block that follows the **using** statement establishes a scope for the object that is created or named in the **using** statement, in this case **wordDoc**. Because the <xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument> class in the Open XML SDK
automatically saves and closes the object as part of its **System.IDisposable** implementation, and because the **Dispose** method is automatically called when you exit the block; you do not have to explicitly call **Save** and **Close**, as long as you use **using**.
[!include[Using Statement](../includes/using-statement.md)]

[!include[Structure](../includes/word/structure.md)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ programmatically.
To open an existing document, instantiate the <xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument> class as shown in
the following two **using** statements. In the
same statement, you open the word processing file with the specified
file name by using the [Open](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) method, with the Boolean parameter.
file name by using the <xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Open%2A> method, with the Boolean parameter.
For the source file that set the parameter to **false** to open it for read-only access. For the
target file, set the parameter to **true** in
order to enable editing the document.
Expand All @@ -57,16 +57,7 @@ order to enable editing the document.
```
***

The `using` statement provides a recommended
alternative to the typical .Create, .Save, .Close sequence. It ensures
that the <xref:System.IDisposable.Dispose> method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the using
statement establishes a scope for the object that is created or named in
the `using` statement. Because the <xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument> class in the Open XML SDK
automatically saves and closes the object as part of its <xref:System.IDisposable> implementation, and because
<xref:System.IDisposable.Dispose> is automatically called when you
exit the block, you do not have to explicitly call <xref:DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Save%2A>.
[!include[Using Statement](../includes/using-statement.md)]

--------------------------------------------------------------------------------

Expand Down
10 changes: 1 addition & 9 deletions docs/general/how-to-create-a-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,7 @@ template.
```
***

The **using** statement provides a recommended
alternative to the typical .Create, .Save, .Close sequence. It ensures
that the **Dispose** () method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing bracket is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case **wordDoc**. Because the <xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument> class in the Open XML SDK
automatically saves and closes the object as part of its **System.IDisposable** implementation, and because
**Dispose** is automatically called when you exit the bracketed block, you do not have to explicitly call **Save** and **Close**─as
long as you use **using**.
[!include[Using Statement](../includes/using-statement.md)]

Once you have created the Word document package, you can add parts to
it. To add the main document part you call <xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument.AddMainDocumentPart%2A>. Having done that,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,7 @@ opened in read-only mode to avoid accidental changes.
```
***


The **using** statement provides a recommended
alternative to the typical .Create, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case **wordDoc**. Because the <xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument> class in the Open XML SDK
automatically saves and closes the object as part of its **System.IDisposable** implementation, and because
the **Dispose** method is automatically called
when you exit the block; you do not have to explicitly call **Save** and **Close**─as
long as you use using.
[!include[Using Statement](../includes/using-statement.md)]


---------------------------------------------------------------------------------
Expand Down
11 changes: 1 addition & 10 deletions docs/general/how-to-remove-a-document-part-from-a-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,7 @@ should be opened in read/write mode.
***


The **using** statement provides a recommended
alternative to the typical .Create, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case **wordDoc**. Because the <xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument> class in the Open XML SDK
automatically saves and closes the object as part of its **System.IDisposable** implementation, and because
the **Dispose** method is automatically called
when you exit the block; you do not have to explicitly call **Save** and **Close**─as
long as you use **using**.
[!include[Using Statement](../includes/using-statement.md)]


---------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ In the sample code, you start by opening the word processing file by
instantiating the <xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument> class as shown in
the following **using** statement. In the same
statement, you open the word processing file *document* by using the
[Open](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) method, with the Boolean parameter set
<xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Open%2A> method, with the Boolean parameter set
to **true** to enable editing the document.

### [C#](#tab/cs-0)
Expand All @@ -49,19 +49,7 @@ to **true** to enable editing the document.
```
***


The **using** statement provides a recommended
alternative to the typical .Open, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case *wordDoc*. Because
the <xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument> class in the
Open XML SDK automatically saves and closes the object as part of its
**System.IDisposable** implementation, and
because **Dispose** is automatically called
when you exit the block, you do not have to explicitly call **Save** and **Close**─as
long as you use **using**.
[!include[Using Statement](../includes/using-statement.md)]


## How to Change Theme in a Word Package
Expand Down
15 changes: 2 additions & 13 deletions docs/general/how-to-search-and-replace-text-in-a-document-part.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ In the sample code, you start by opening the word processing file by
instantiating the **<xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument>** class as shown in
the following **using** statement. In the same
statement, you open the word processing file *document* by using the
**[Open](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open)** method, with the Boolean parameter set
**<xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Open%2A>** method, with the Boolean parameter set
to **true** to enable editing the document.

### [C#](#tab/cs-0)
Expand All @@ -53,18 +53,7 @@ to **true** to enable editing the document.
***


The **using** statement provides a recommended
alternative to the typical .Open, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case *wordDoc*. Because
the <xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument> class in the
Open XML SDK automatically saves and closes the object as part of its
**System.IDisposable** implementation, and
because **Dispose** is automatically called
when you exit the block, you do not have to explicitly call **Save** and **Close**─as
long as you use **using**.
[!include[Using Statement](../includes/using-statement.md)]


--------------------------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions docs/includes/using-statement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
The `using` statement provides a recommended
alternative to the typical .Create, .Save, .Close sequence. It ensures
that the <xref:System.IDisposable.Dispose> method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the using
statement establishes a scope for the object that is created or named in
the using statement. Because the <xref:DocumentFormat.OpenXml.Packaging.WordprocessingDocument> class in the Open XML SDK
automatically saves and closes the object as part of its <xref:System.IDisposable> implementation, and because
<xref:System.IDisposable.Dispose> is automatically called when you
exit the block, you do not have to explicitly call <xref:DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Save> and
<xref:DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Close> as long as you use `using`.
7 changes: 1 addition & 6 deletions docs/presentation/how-to-apply-a-theme-to-a-presentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,7 @@ represents the path for the target presentation document.
***


The **using** statement provides a recommended
alternative to the typical .Open, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case **themeDocument** and **presentationDocument**.
[!include[Using Statement](../includes/using-statement.md)]


-----------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,7 @@ you want to open the document.
***


The **using** statement provides a recommended
alternative to the typical .Open, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case *ppt*.
[!include[Using Statement](../includes/using-statement.md)]


## The Structure of the Shape Tree
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ statement.
***


The **using** statement provides a recommended alternative to the typical .Open, .Save, .Close sequence. It ensures that the **Dispose** method (internal method used by the Open XML SDK to clean up resources) is automatically called when the closing brace is reached. The block that follows the **using** statement establishes a scope for the object that is created or named in the **using** statement, in this case **presentationDocument**.
[!include[Using Statement](../includes/using-statement.md)]

[!include[Structure](../includes/presentation/structure.md)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ Options.
***


The **using** statement provides a recommended
alternative to the typical .Open, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case *doc*.
[!include[Using Statement](../includes/using-statement.md)]

[!include[Structure](../includes/presentation/structure.md)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ path for the file from which you want to open the document.
***


The **using** statement provides a recommended
alternative to the typical .Open, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case **document**.
[!include[Using Statement](../includes/using-statement.md)]


--------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,7 @@ document.
***


The **using** statement provides a recommended
alternative to the typical .Open, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case **presentationDocument**.
[!include[Using Statement](../includes/using-statement.md)]


--------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,7 @@ document.
***


The **using** statement provides a recommended
alternative to the typical .Open, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case **presentationDocument**.
[!include[Using Statement](../includes/using-statement.md)]


--------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,7 @@ document.
```
***


The **using** statement provides a recommended
alternative to the typical .Open, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case
*presentationDocument*.
[!include[Using Statement](../includes/using-statement.md)]

[!include[Structure](../includes/presentation/structure.md)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,7 @@ document.
```
***


The **using** statement provides a recommended
alternative to the typical .Open, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case
*presentationDocument*.
[!include[Using Statement](../includes/using-statement.md)]

[!include[Structure](../includes/presentation/structure.md)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,7 @@ for the file from which you want to open the document.
```
***


The **using** statement provides a recommended
alternative to the typical .Open, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case *doc*.
[!include[Using Statement](../includes/using-statement.md)]

[!include[Structure](../includes/presentation/structure.md)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,7 @@ open the document.
```
***


The **using** statement provides a recommended
alternative to the typical .Open, .Save, .Close sequence. It ensures
that the **Dispose** method (internal method
used by the Open XML SDK to clean up resources) is automatically called
when the closing brace is reached. The block that follows the **using** statement establishes a scope for the
object that is created or named in the **using** statement, in this case **presentationDocument**.
[!include[Using Statement](../includes/using-statement.md)]


--------------------------------------------------------------------------------
Expand Down
Loading
Loading