Skip to content

Commit 228bdd7

Browse files
authored
Extract code snippets, move ISO references to snippets, update msdn links to learn.microsoft (#305)
* closes #265 (working-with-wordprocessingml-tables.md) * closes #264 (working-with-runs.md) * closes #263 (working-with-paragraphs.md) * closes #299 (xmlns should use http instead of https in multiple files) * closes #262 (structure-of-a-wordprocessingml-document.md) * closes #301 (Ensure we're not referencing specific versions) * closes #261 (how-to-validate-a-word-processing-document.md) * closes #239 (how-to-set-the-font-for-a-text-run.md) * closes #302 (Convert MSDN links to microsoft.learn) * closes #304 (Extract ISO/IEC 29500 references to snippet) * make https://learn.microsoft.com links relative
1 parent 4e003d5 commit 228bdd7

File tree

112 files changed

+1141
-1045
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1141
-1045
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,4 +287,6 @@ __pycache__/
287287
*.odx.cs
288288
*.xsd.cs
289289

290-
docs/open-xml-docs/
290+
docs/open-xml-docs/
291+
samples/**/Properties/**/*
292+
samples/**/My\ Project/**/*

docs/about-the-open-xml-sdk.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ The SDK supports the following common tasks/scenarios:
6262

6363
## Open XML SDK for Office
6464

65-
The Open XML SDK provides the namespaces and members to support the Microsoft Office 2013. The Open XML SDK can also read ISO/IEC 29500 Strict Format files. The Strict format is a subset of the Transitional format that does not include legacy features - this makes it theoretically easier for a new implementer to support since it has a smaller technical footprint.
65+
The Open XML SDK provides the namespaces and members to support the Microsoft Office. The Open XML SDK can also read ISO/IEC 29500 Strict Format files. The Strict format is a subset of the Transitional format that does not include legacy features - this makes it theoretically easier for a new implementer to support since it has a smaller technical footprint.
6666

6767
The SDK supports the following common tasks/scenarios:
6868

69-
- **Support of Office 2013 Preview file format** In addition to the Open XML SDK for Microsoft Office classes, Open XML SDK provides new classes that enable you to write and build applications to manipulate Open XML file extensions of the new Office 2013 features.
69+
- **Support of Office Preview file format** In addition to the Open XML SDK for Microsoft Office classes, Open XML SDK provides new classes that enable you to write and build applications to manipulate Open XML file extensions of the new Office features.
7070
- **Reads ISO Strict Document File** Open XML SDK can read ISO/IEC 29500 Strict Format files. When the Open XML SDK API opens a Strict Format file, each Open XML part in the file is loaded to an **OpenXmlPart** class of the Open XML SDK by mapping `https://purl.oclc.org/ooxml/` namespaces to the corresponding `https://schemas.openxmlformats.org/` namespaces.
7171
- **Fixes to the Open XML SDK for Microsoft Office** Open XML SDK includes fixes to known issues in the Open XML SDK for Microsoft Office. These include lost whitespaces in PowerPoint presentations and an issue with the Custom UI in Word documents where a specified argument was reported as being out of the range of valid values.
7272

docs/general/how-to-add-a-new-document-part-to-a-package.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This topic shows how to use the classes in the Open XML SDK for Office to add a
2121

2222
## Get a WordprocessingDocument object
2323

24-
The code starts with opening a package file by passing a file name to one of the overloaded **[Open()](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.open.aspx)** methods of the **[DocumentFormat.OpenXml.Packaging.WordprocessingDocument](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.aspx)** that takes a string and a Boolean value that specifies whether the file should be opened for editing or for read-only access. In this case, the Boolean value is **true** specifying that the file should be opened in read/write mode.
24+
The code starts with opening a package file by passing a file name to one of the overloaded **[Open()](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open)** methods of the **[DocumentFormat.OpenXml.Packaging.WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument)** that takes a string and a Boolean value that specifies whether the file should be opened for editing or for read-only access. In this case, the Boolean value is **true** specifying that the file should be opened in read/write mode.
2525

2626
### [C#](#tab/cs-0)
2727
```csharp

docs/general/how-to-copy-the-contents-of-an-open-xml-package-part-to-a-document-part-in-a-dif.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ programmatically.
3030

3131
--------------------------------------------------------------------------------
3232
## Getting a WordprocessingDocument Object
33-
To open an existing document, instantiate the [WordprocessingDocument](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.aspx) class as shown in
33+
To open an existing document, instantiate the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class as shown in
3434
the following two **using** statements. In the
3535
same statement, you open the word processing file with the specified
36-
file name by using the [Open](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.open.aspx) method, with the Boolean parameter.
36+
file name by using the [Open](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) method, with the Boolean parameter.
3737
For the source file that set the parameter to **false** to open it for read-only access. For the
3838
target file, set the parameter to **true** in
3939
order to enable editing the document.
@@ -78,7 +78,7 @@ long as you use **using**.
7878
--------------------------------------------------------------------------------
7979
## The Theme Part
8080
The theme part contains information about the color, font, and format of
81-
a document. It is defined in the [ISO/IEC 29500](https://www.iso.org/standard/71691.html) specification as
81+
a document. It is defined in the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification as
8282
follows.
8383

8484
An instance of this part type contains information about a document's
@@ -110,7 +110,7 @@ is stored in the ZIP item theme/theme1.xml:
110110
```
111111

112112

113-
© ISO/IEC29500: 2008.
113+
© [!include[ISO/IEC 29500 version](../includes/iso-iec-29500-version.md)]
114114

115115

116116
--------------------------------------------------------------------------------
@@ -191,7 +191,7 @@ following example, which copies the theme part from "MyPkg4.docx" to
191191

192192

193193
> [!IMPORTANT]
194-
> Before you run the program, make sure that the source document (MyPkg4.docx) has the theme part set; otherwise, an exception would be thrown. To add a theme to a document, open it in Microsoft Word 2013, click the **Page Layout** tab, click **Themes**, and select one of the available themes.
194+
> Before you run the program, make sure that the source document (MyPkg4.docx) has the theme part set; otherwise, an exception would be thrown. To add a theme to a document, open it in Microsoft Word, click the **Page Layout** tab, click **Themes**, and select one of the available themes.
195195

196196
After running the program, you can inspect the file "MyPkg3.docx" to see
197197
the copied theme from the file "MyPkg4.docx."

docs/general/how-to-create-a-package.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ from content in the form of **WordprocessingML** XML markup.
2626

2727
## Getting a WordprocessingDocument Object
2828

29-
In the Open XML SDK, the [WordprocessingDocument](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.aspx) class represents a Word document package. To create a Word document, you create an instance
29+
In the Open XML SDK, the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class represents a Word document package. To create a Word document, you create an instance
3030
of the **WordprocessingDocument** class and
3131
populate it with parts. At a minimum, the document must have a main
3232
document part that serves as a container for the main text of the
3333
document. The text is represented in the package as XML using **WordprocessingML** markup.
3434

35-
To create the class instance you call the [Create(String, WordprocessingDocumentType)](https://msdn.microsoft.com/library/office/cc535610.aspx)
35+
To create the class instance you call the [Create(String, WordprocessingDocumentType)](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.create)
3636
method. Several **Create** methods are
3737
provided, each with a different signature. The sample code in this topic
3838
uses the **Create** method with a signature
3939
that requires two parameters. The first parameter takes a full path
4040
string that represents the document that you want to create. The second
41-
parameter is a member of the [WordprocessingDocumentType](https://msdn.microsoft.com/library/office/documentformat.openxml.wordprocessingdocumenttype.aspx) enumeration.
41+
parameter is a member of the [WordprocessingDocumentType](/dotnet/api/documentformat.openxml.wordprocessingdocumenttype) enumeration.
4242
This parameter represents the type of document. For example, there is a
43-
different member of the [WordProcessingDocumentType](https://msdn.microsoft.com/library/office/documentformat.openxml.wordprocessingdocumenttype.aspx) enumeration for each
43+
different member of the [WordProcessingDocumentType](/dotnet/api/documentformat.openxml.wordprocessingdocumenttype) enumeration for each
4444
of document, template, and the macro enabled variety of document and
4545
template.
4646

@@ -75,7 +75,7 @@ automatically saves and closes the object as part of its **System.IDisposable**
7575
long as you use **using**.
7676

7777
Once you have created the Word document package, you can add parts to
78-
it. To add the main document part you call the [AddMainDocumentPart()](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.addmaindocumentpart.aspx) method of the **WordprocessingDocument** class. Having done that,
78+
it. To add the main document part you call the [AddMainDocumentPart()](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.addmaindocumentpart) method of the **WordprocessingDocument** class. Having done that,
7979
you can set about adding the document structure and text.
8080

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

docs/general/how-to-get-the-contents-of-a-document-part-from-a-package.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ document programmatically.
2929
---------------------------------------------------------------------------------
3030
## Getting a WordprocessingDocument Object
3131
The code starts with opening a package file by passing a file name to
32-
one of the overloaded [Open()](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.open.aspx) methods (Visual Basic .NET Shared
33-
method or C\# static method) of the [WordprocessingDocument](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.aspx) class that takes a
32+
one of the overloaded [Open()](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) methods (Visual Basic .NET Shared
33+
method or C\# static method) of the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class that takes a
3434
string and a Boolean value that specifies whether the file should be
3535
opened in read/write mode or not. In this case, the Boolean value is
3636
**false** specifying that the file should be
@@ -75,7 +75,7 @@ long as you use using.
7575
## Comments Element
7676
In this how-to, you are going to work with comments. Therefore, it is
7777
useful to familiarize yourself with the structure of the \<**comments**\> element. The following information
78-
from the [ISO/IEC 29500](https://www.iso.org/standard/71691.html)
78+
from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)]
7979
specification can be useful when working with this element.
8080

8181
This element specifies all of the comments defined in the current
@@ -95,7 +95,7 @@ document:
9595
The **comments** element contains the single
9696
comment specified by this document in this example.
9797

98-
© ISO/IEC29500: 2008.
98+
© [!include[ISO/IEC 29500 version](../includes/iso-iec-29500-version.md)]
9999

100100
The following XML schema fragment defines the contents of this element.
101101

@@ -197,4 +197,4 @@ Following is the complete code example in both C\# and Visual Basic.
197197

198198

199199
[Open XML SDK class library
200-
reference](https://msdn.microsoft.com/library/36c8a76e-ce1b-5959-7e85-5d77db7f46d6(Office.15).aspx)
200+
reference](/office/open-xml/open-xml-sdk)

docs/general/how-to-remove-a-document-part-from-a-package.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ programmatically.
2929
---------------------------------------------------------------------------------
3030
## Getting a WordprocessingDocument Object
3131
The code example starts with opening a package file by passing a file
32-
name as an argument to one of the overloaded [Open()](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.open.aspx) methods of the [DocumentFormat.OpenXml.Packaging.WordprocessingDocument](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.aspx)
32+
name as an argument to one of the overloaded [Open()](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) methods of the [DocumentFormat.OpenXml.Packaging.WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument)
3333
that takes a string and a Boolean value that specifies whether the file
3434
should be opened in read/write mode or not. In this case, the Boolean
3535
value is **true** specifying that the file
@@ -72,8 +72,7 @@ long as you use **using**.
7272

7373
--------------------------------------------------------------------------------
7474
## Settings Element
75-
The following text from the [ISO/IEC
76-
29500](https://www.iso.org/standard/71691.html) specification
75+
The following text from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification
7776
introduces the settings element in a **PresentationML** package.
7877

7978
> This element specifies the settings that are applied to a
@@ -95,7 +94,7 @@ introduces the settings element in a **PresentationML** package.
9594
> automatic tab stop increments of 0.5" using the **defaultTabStop** element, and no character level
9695
> white space compression using the **characterSpacingControl** element.
9796
>
98-
> © ISO/IEC29500: 2008.
97+
> © [!include[ISO/IEC 29500 version](../includes/iso-iec-29500-version.md)]
9998
10099

101100
--------------------------------------------------------------------------------

docs/general/how-to-replace-the-theme-part-in-a-word-processing-document.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ document.
2626
## Getting a WordprocessingDocument Object
2727

2828
In the sample code, you start by opening the word processing file by
29-
instantiating the [WordprocessingDocument](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.aspx) class as shown in
29+
instantiating the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class as shown in
3030
the following **using** statement. In the same
3131
statement, you open the word processing file *document* by using the
32-
[Open](https://msdn.microsoft.com/library/office/cc562234.aspx) method, with the Boolean parameter set
32+
[Open](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) method, with the Boolean parameter set
3333
to **true** to enable editing the document.
3434

3535
### [C#](#tab/cs-0)
@@ -78,7 +78,7 @@ in your computer.
7878
The theme element constitutes of color, font, and format schemes. In
7979
this how-to you learn how to change the theme programmatically.
8080
Therefore, it is useful to familiarize yourself with the theme element.
81-
The following information from the [ISO/IEC 29500](https://www.iso.org/standard/71691.html) specification can
81+
The following information from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification can
8282
be useful when working with this element.
8383

8484
This element defines the root level complex type associated with a
@@ -97,17 +97,17 @@ In this example, we see how a theme can affect font, colors,
9797
backgrounds, fills, and effects for different objects in a presentation.
9898
*end example*]
9999

100-
© ISO/IEC29500: 2008.
100+
© [!include[ISO/IEC 29500 version](../includes/iso-iec-29500-version.md)]
101101

102102
The following table lists the possible child types of the Theme class.
103103

104104
| PresentationML Element | Open XML SDK Class | Description |
105105
|---|---|---|
106-
| custClrLst | [CustomColorList](https://msdn.microsoft.com/library/office/documentformat.openxml.drawing.customcolorlist.aspx) |Custom Color List |
107-
| extLst | [ExtensionList](https://msdn.microsoft.com/library/office/documentformat.openxml.presentation.extensionlist.aspx) | Extension List |
108-
| extraClrSchemeLst | [ExtraColorSchemeList](https://msdn.microsoft.com/library/office/documentformat.openxml.drawing.theme.extracolorschemelist.aspx) | Extra Color Scheme List |
109-
| objectDefaults | [ObjectDefaults](https://msdn.microsoft.com/library/office/documentformat.openxml.drawing.theme.objectdefaults.aspx) | Object Defaults |
110-
| themeElements | [ThemeElements](https://msdn.microsoft.com/library/office/documentformat.openxml.drawing.theme.themeelements.aspx) | Theme Elements |
106+
| custClrLst | [CustomColorList](/dotnet/api/documentformat.openxml.drawing.customcolorlist) |Custom Color List |
107+
| extLst | [ExtensionList](/dotnet/api/documentformat.openxml.presentation.extensionlist) | Extension List |
108+
| extraClrSchemeLst | [ExtraColorSchemeList](/dotnet/api/documentformat.openxml.drawing.theme.extracolorschemelist) | Extra Color Scheme List |
109+
| objectDefaults | [ObjectDefaults](/dotnet/api/documentformat.openxml.drawing.theme.objectdefaults) | Object Defaults |
110+
| themeElements | [ThemeElements](/dotnet/api/documentformat.openxml.drawing.theme.themeelements) | Theme Elements |
111111

112112
The following XML Schema fragment defines the four parts of the theme
113113
element. The **themeElements** element is the

docs/general/how-to-search-and-replace-text-in-a-document-part.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ processing document.
2929
---------------------------------------------------------------------------------
3030
## Getting a WordprocessingDocument Object
3131
In the sample code, you start by opening the word processing file by
32-
instantiating the **[WordprocessingDocument](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.aspx)** class as shown in
32+
instantiating the **[WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument)** class as shown in
3333
the following **using** statement. In the same
3434
statement, you open the word processing file *document* by using the
35-
**[Open](https://msdn.microsoft.com/library/office/cc562234.aspx)** method, with the Boolean parameter set
35+
**[Open](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open)** method, with the Boolean parameter set
3636
to **true** to enable editing the document.
3737

3838
### [C#](#tab/cs-0)
@@ -111,4 +111,4 @@ The following is the complete sample code in both C\# and Visual Basic.
111111

112112
- [Open XML SDK class library reference](/office/open-xml/open-xml-sdk)
113113

114-
[Regular Expressions](https://msdn.microsoft.com/library/hs600312.aspx)
114+
[Regular Expressions](/dotnet/standard/base-types/regular-expressions)

0 commit comments

Comments
 (0)