Skip to content

Commit

Permalink
Extract code snippets, move ISO references to snippets, update msdn l…
Browse files Browse the repository at this point in the history
…inks 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
  • Loading branch information
mikeebowen authored Jan 25, 2024
1 parent 4e003d5 commit 228bdd7
Show file tree
Hide file tree
Showing 112 changed files with 1,141 additions and 1,045 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,6 @@ __pycache__/
*.odx.cs
*.xsd.cs

docs/open-xml-docs/
docs/open-xml-docs/
samples/**/Properties/**/*
samples/**/My\ Project/**/*
4 changes: 2 additions & 2 deletions docs/about-the-open-xml-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ The SDK supports the following common tasks/scenarios:

## Open XML SDK for Office

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.
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.

The SDK supports the following common tasks/scenarios:

- **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.
- **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.
- **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.
- **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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This topic shows how to use the classes in the Open XML SDK for Office to add a

## Get a WordprocessingDocument object

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.
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.

### [C#](#tab/cs-0)
```csharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ programmatically.

--------------------------------------------------------------------------------
## Getting a WordprocessingDocument Object
To open an existing document, instantiate the [WordprocessingDocument](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.aspx) class as shown in
To open an existing document, instantiate the [WordprocessingDocument](/dotnet/api/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](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.open.aspx) method, with the Boolean parameter.
file name by using the [Open](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) 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 Down Expand Up @@ -78,7 +78,7 @@ long as you use **using**.
--------------------------------------------------------------------------------
## The Theme Part
The theme part contains information about the color, font, and format of
a document. It is defined in the [ISO/IEC 29500](https://www.iso.org/standard/71691.html) specification as
a document. It is defined in the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification as
follows.

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


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


--------------------------------------------------------------------------------
Expand Down Expand Up @@ -191,7 +191,7 @@ following example, which copies the theme part from "MyPkg4.docx" to


> [!IMPORTANT]
> 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.
> 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.

After running the program, you can inspect the file "MyPkg3.docx" to see
the copied theme from the file "MyPkg4.docx."
Expand Down
10 changes: 5 additions & 5 deletions docs/general/how-to-create-a-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ from content in the form of **WordprocessingML** XML markup.

## Getting a WordprocessingDocument Object

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
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
of the **WordprocessingDocument** class and
populate it with parts. At a minimum, the document must have a main
document part that serves as a container for the main text of the
document. The text is represented in the package as XML using **WordprocessingML** markup.

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

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

Once you have created the Word document package, you can add parts to
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,
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,
you can set about adding the document structure and text.

[!include[Structure](../includes/word/structure.md)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ document programmatically.
---------------------------------------------------------------------------------
## Getting a WordprocessingDocument Object
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 (Visual Basic .NET Shared
method or C\# static method) of the [WordprocessingDocument](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.aspx) class that takes a
one of the overloaded [Open()](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) methods (Visual Basic .NET Shared
method or C\# static method) of the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class that takes a
string and a Boolean value that specifies whether the file should be
opened in read/write mode or not. In this case, the Boolean value is
**false** specifying that the file should be
Expand Down Expand Up @@ -75,7 +75,7 @@ long as you use using.
## Comments Element
In this how-to, you are going to work with comments. Therefore, it is
useful to familiarize yourself with the structure of the \<**comments**\> element. The following information
from the [ISO/IEC 29500](https://www.iso.org/standard/71691.html)
from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)]
specification can be useful when working with this element.

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

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

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

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


[Open XML SDK class library
reference](https://msdn.microsoft.com/library/36c8a76e-ce1b-5959-7e85-5d77db7f46d6(Office.15).aspx)
reference](/office/open-xml/open-xml-sdk)
7 changes: 3 additions & 4 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 @@ -29,7 +29,7 @@ programmatically.
---------------------------------------------------------------------------------
## Getting a WordprocessingDocument Object
The code example starts with opening a package file by passing a file
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)
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)
that takes a string and a Boolean value that specifies whether the file
should be opened in read/write mode or not. In this case, the Boolean
value is **true** specifying that the file
Expand Down Expand Up @@ -72,8 +72,7 @@ long as you use **using**.

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

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

--------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ document.
## Getting a WordprocessingDocument Object

In the sample code, you start by opening the word processing file by
instantiating the [WordprocessingDocument](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.aspx) class as shown in
instantiating the [WordprocessingDocument](/dotnet/api/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](https://msdn.microsoft.com/library/office/cc562234.aspx) method, with the Boolean parameter set
[Open](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) method, with the Boolean parameter set
to **true** to enable editing the document.

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

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

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

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

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

The following XML Schema fragment defines the four parts of the theme
element. The **themeElements** element is the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ processing document.
---------------------------------------------------------------------------------
## Getting a WordprocessingDocument Object
In the sample code, you start by opening the word processing file by
instantiating the **[WordprocessingDocument](https://msdn.microsoft.com/library/office/documentformat.openxml.packaging.wordprocessingdocument.aspx)** class as shown in
instantiating the **[WordprocessingDocument](/dotnet/api/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](https://msdn.microsoft.com/library/office/cc562234.aspx)** method, with the Boolean parameter set
**[Open](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open)** method, with the Boolean parameter set
to **true** to enable editing the document.

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

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

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

0 comments on commit 228bdd7

Please sign in to comment.