diff --git a/.openpublishing.publish.config.json b/.openpublishing.publish.config.json index 5e32ffa..e83d154 100644 --- a/.openpublishing.publish.config.json +++ b/.openpublishing.publish.config.json @@ -6,13 +6,42 @@ "build_output_subfolder": "open-xml-docs", "locale": "en-us", "monikers": [], - "moniker_ranges": [], + "moniker_ranges": [ + "openxml-2.7.1", + "openxml-2.7.2", + "openxml-2.8.0", + "openxml-2.8.1", + "openxml-2.9.0", + "openxml-2.9.1", + "openxml-2.10.0", + "openxml-2.10.1", + "openxml-2.11.0", + "openxml-2.11.1", + "openxml-2.11.2", + "openxml-2.11.3", + "openxml-2.12.0", + "openxml-2.12.1", + "openxml-2.12.2", + "openxml-2.12.3", + "openxml-2.13.0", + "openxml-2.13.1", + "openxml-2.14.0", + "openxml-2.15.0", + "openxml-2.16.0", + "openxml-2.17.1", + "openxml-2.18.0", + "openxml-2.19.0", + "openxml-2.20.0", + "openxml-3.0.0", + "openxml-3.0.1" + ], "open_to_public_contributors": true, "customized_tasks": { "docset_prebuild": [ "_dependentPackages/CommonPlugins/tools/JoinTOC.ps1" ] }, + "xref_query_tags": [ "/dotnet" ], "type_mapping": { "Conceptual": "Content", "ManagedReference": "Content", diff --git a/docs/general/features.md b/docs/general/features.md index 665a762..6c3587c 100644 --- a/docs/general/features.md +++ b/docs/general/features.md @@ -38,12 +38,13 @@ private sealed class PrivateFeature { } ``` + > [!NOTE] > The feature collection on elements is readonly. This is due to memory issues if it is made writeable. If this is needed, please engage on https://github.com/dotnet/open-xml-sdk to let us know your scenario. ## Visualizing Registered Features -The in-box implementations of the `IFeatureCollection` provide a helpful debug view so you can see what features are available and what their properties/fields are: +The in-box implementations of the provide a helpful debug view so you can see what features are available and what their properties/fields are: ![Features Debug View](../media/feature-debug-view.png) @@ -51,7 +52,7 @@ The in-box implementations of the `IFeatureCollection` provide a helpful debug v The features that are currently available are described below and at what scope they are available: -### IDisposableFeature +### This feature allows for registering actions that need to run when a package or a part is destroyed or disposed: @@ -65,7 +66,7 @@ part.Features.Get().Register(() => /* Some action that is ca Packages and parts will have their own implementations of this feature. Elements will retrieve the feature for their containing part if available. -### IPackageEventsFeature +### This feature allows getting event notifications of when a package is changed: @@ -79,7 +80,7 @@ var feature = package.Features.GetRequired(); > [!NOTE] > There may be times when the package is changed but an event is not fired. Not all areas have been identified where it would make sense to raise an event. Please file an issue if you find one. -### IPartEventsFeature +### This feature allows getting event notifications of when an event is being created. This is a feature that is added to the part or package: @@ -95,7 +96,7 @@ Generally, assume that there may be a singleton implementation for the events an > [!NOTE] > There may be times when the part is changed but an event is not fired. Not all areas have been identified where it would make sense to raise an event. Please file an issue if you find one. -### IPartRootEventsFeature +### This feature allows getting event notifications of when a part root is being modified/loaded/created/etc. This is a feature that is added to the part level feature: @@ -111,11 +112,11 @@ Generally, assume that there may be a singleton implementation for the events an > [!NOTE] > There may be times when the part root is changed but an event is not fired. Not all areas have been identified where it would make sense to raise an event. Please file an issue if you find one. -### IRandomNumberGeneratorFeature +### This feature allows for a shared service to generate random numbers and fill an array. -### IParagraphIdGeneratorFeature +### This feature allows for population and tracking of elements that contain paragraph ids. By default, this will ensure uniqueness of values and ensure that values that do exist are valid per the constraints of the standard. To use this feature: @@ -159,21 +160,3 @@ body2.AddChild(p2); Assert.NotEqual(p1.ParagraphId, p2.ParagraphId); Assert.Equal(2, shared.Count); ``` - -### IPartRootXElementFeature - -This feature allows operating on an `OpenXmlPart` by using XLinq features and directly manipulating `XElement` nodes. - -```csharp -OpenXmlPart part = GetSomePart(); - -var node = new(W.document, new XAttribute(XNamespace.Xmlns + "w", W.w), - new XElement(W.body, - new XElement(W.p, - new XElement(W.r, - new XElement(W.t, "Hello World!"))))); - -part.SetXElement(node); -``` - -This `XElement` is cached but will be kept in sync with the underlying part if it were to change. diff --git a/docs/general/how-to-add-a-new-document-part-to-a-package.md b/docs/general/how-to-add-a-new-document-part-to-a-package.md index 46e18fc..bc5ba2d 100644 --- a/docs/general/how-to-add-a-new-document-part-to-a-package.md +++ b/docs/general/how-to-add-a-new-document-part-to-a-package.md @@ -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()](/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. +The code starts with opening a package file by passing a file name to one of the overloaded methods of the 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 @@ -40,14 +40,14 @@ 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 **WordprocessingDocument** class in the Open XML SDK +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 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[Structure](../includes/word/structure.md)] ## How the sample code works -After opening the document for editing, in the **using** statement, as a **WordprocessingDocument** object, the code creates a reference to the **MainDocumentPart** part and adds a new custom XML part. It then reads the contents of the external +After opening the document for editing, in the **using** statement, as a object, the code creates a reference to the **MainDocumentPart** part and adds a new custom XML part. It then reads the contents of the external file that contains the custom XML and writes it to the **CustomXmlPart** part. > [!NOTE] diff --git a/docs/general/how-to-copy-the-contents-of-an-open-xml-package-part-to-a-document-part-in-a-dif.md b/docs/general/how-to-copy-the-contents-of-an-open-xml-package-part-to-a-document-part-in-a-dif.md index 272ba2a..5d9bf19 100644 --- a/docs/general/how-to-copy-the-contents-of-an-open-xml-package-part-to-a-document-part-in-a-dif.md +++ b/docs/general/how-to-copy-the-contents-of-an-open-xml-package-part-to-a-document-part-in-a-dif.md @@ -30,7 +30,7 @@ programmatically. -------------------------------------------------------------------------------- ## Getting a WordprocessingDocument Object -To open an existing document, instantiate the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class as shown in +To open an existing document, instantiate the 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. @@ -57,19 +57,16 @@ order to enable editing the document. ``` *** - -The **using** statement provides a recommended +The `using` statement provides a recommended alternative to the typical .Create, .Save, .Close sequence. It ensures -that the **Dispose** method (internal method +that the 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 **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**. - +the `using` statement. Because the class in the Open XML SDK +automatically saves and closes the object as part of its implementation, and because + is automatically called when you +exit the block, you do not have to explicitly call . -------------------------------------------------------------------------------- @@ -117,9 +114,9 @@ is stored in the ZIP item theme/theme1.xml: ## How the Sample Code Works To copy the contents of a document part in an Open XML package to a document part in a different package, the full path of the each word -processing document is passed in as a parameter to the **CopyThemeContent** method. The code then opens both -documents as **WordprocessingDocument** -objects, and creates variables that reference the **ThemePart** parts in each of the packages. +processing document is passed in as a parameter to the `CopyThemeContent` method. The code then opens both +documents as +objects, and creates variables that reference the parts in each of the packages. ### [C#](#tab/cs-1) ```csharp @@ -144,8 +141,8 @@ objects, and creates variables that reference the **ThemePart** parts in each of *** -The code then reads the contents of the source **ThemePart** part by using a **StreamReader** object and writes to the target -**ThemePart** part by using a **StreamWriter** object. +The code then reads the contents of the source part by using a **StreamReader** object and writes to the target + part by using a . ### [C#](#tab/cs-2) ```csharp @@ -170,7 +167,7 @@ The code then reads the contents of the source **ThemePart** part by using a **S -------------------------------------------------------------------------------- ## Sample Code The following code copies the contents of one document part in an Open -XML package to a document part in a different package. To call the **CopyThemeContent** method, you can use the +XML package to a document part in a different package. To call the `CopyThemeContent`` method, you can use the following example, which copies the theme part from "MyPkg4.docx" to "MyPkg3.docx." @@ -207,9 +204,4 @@ Following is the complete sample code in both C\# and Visual Basic. -------------------------------------------------------------------------------- ## See also - - [Open XML SDK class library reference](/office/open-xml/open-xml-sdk) - - - - diff --git a/docs/general/how-to-create-a-package.md b/docs/general/how-to-create-a-package.md index 0aa2c48..c40dea4 100644 --- a/docs/general/how-to-create-a-package.md +++ b/docs/general/how-to-create-a-package.md @@ -23,29 +23,25 @@ from content in the form of **WordprocessingML** XML markup. [!include[Structure](../includes/word/packages-and-document-parts.md)] - ## Getting a WordprocessingDocument Object -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 +In the Open XML SDK, the class represents a Word document package. To create a Word document, you create an instance +of the 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)](/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 +To create the class instance you call . Several methods are +provided, each with a different signature. 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](/dotnet/api/documentformat.openxml.wordprocessingdocumenttype) enumeration. +parameter is a member of the enumeration. This parameter represents the type of document. For example, there is a -different member of the [WordProcessingDocumentType](/dotnet/api/documentformat.openxml.wordprocessingdocumenttype) enumeration for each +different member of the enumeration for each of document, template, and the macro enabled variety of document and template. > [!NOTE] -> Carefully select the appropriate **WordProcessingDocumentType** and verify that the persisted file has the correct, matching file extension. If the **WordProcessingDocumentType** does not match the file extension, an error occurs when you open the file in Microsoft Word. The code that calls the **Create** method is part of a **using** statement followed by a bracketed block, as shown in the following code example. +> Carefully select the appropriate and verify that the persisted file has the correct, matching file extension. If the does not match the file extension, an error occurs when you open the file in Microsoft Word. ### [C#](#tab/cs-0) ```csharp @@ -63,19 +59,18 @@ 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 **WordprocessingDocument** class in the Open XML SDK +object that is created or named in the **using** statement, in this case **wordDoc**. Because the 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**. Once you have created the Word document package, you can add parts to -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, +it. To add the main document part you call . Having done that, you can set about adding the document structure and text. [!include[Structure](../includes/word/structure.md)] @@ -99,7 +94,6 @@ call: ``` *** - After you run the program, open the created file "myPkg4.docx" and examine its content; it should be one paragraph that contains the phrase "Hello world!" @@ -114,9 +108,4 @@ Following is the complete sample code in both C\# and Visual Basic. ## See also - - - [Open XML SDK class library reference](/office/open-xml/open-xml-sdk) - - - diff --git a/docs/general/how-to-get-the-contents-of-a-document-part-from-a-package.md b/docs/general/how-to-get-the-contents-of-a-document-part-from-a-package.md index 8f3cb98..8f2a83b 100644 --- a/docs/general/how-to-get-the-contents-of-a-document-part-from-a-package.md +++ b/docs/general/how-to-get-the-contents-of-a-document-part-from-a-package.md @@ -30,7 +30,7 @@ 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()](/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 +method or C\# static method) of the 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 @@ -60,7 +60,7 @@ 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 **WordprocessingDocument** class in the Open XML SDK +object that is created or named in the **using** statement, in this case **wordDoc**. Because the 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 diff --git a/docs/general/how-to-remove-a-document-part-from-a-package.md b/docs/general/how-to-remove-a-document-part-from-a-package.md index 5287695..fcfaced 100644 --- a/docs/general/how-to-remove-a-document-part-from-a-package.md +++ b/docs/general/how-to-remove-a-document-part-from-a-package.md @@ -59,7 +59,7 @@ 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 **WordprocessingDocument** class in the Open XML SDK +object that is created or named in the **using** statement, in this case **wordDoc**. Because the 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 @@ -99,7 +99,7 @@ introduces the settings element in a **PresentationML** package. -------------------------------------------------------------------------------- ## How the Sample Code Works -After you have opened the document, in the **using** statement, as a **WordprocessingDocument** object, you create a +After you have opened the document, in the **using** statement, as a object, you create a reference to the **DocumentSettingsPart** part. You can then check if that part exists, if so, delete that part from the package. In this instance, the **settings.xml** diff --git a/docs/general/how-to-replace-the-theme-part-in-a-word-processing-document.md b/docs/general/how-to-replace-the-theme-part-in-a-word-processing-document.md index 7b3406c..a8648b6 100644 --- a/docs/general/how-to-replace-the-theme-part-in-a-word-processing-document.md +++ b/docs/general/how-to-replace-the-theme-part-in-a-word-processing-document.md @@ -26,7 +26,7 @@ document. ## Getting a WordprocessingDocument Object In the sample code, you start by opening the word processing file by -instantiating the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class as shown in +instantiating the 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 @@ -56,7 +56,7 @@ 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 **WordprocessingDocument** class in the +the 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 @@ -163,10 +163,10 @@ delete the old theme part. ``` *** -You can then create add a new **ThemePart** +You can then create add a new object and add it to the **MainDocumentPart** -object. Then you add content by using a **StreamReader** and **StreamWriter** objects to copy the theme from the -*themeFile* to the **ThemePart** object. +object. Then you add content by using a **StreamReader** and objects to copy the theme from the +*themeFile* to the object. ### [C#](#tab/cs-2) ```csharp diff --git a/docs/general/how-to-search-and-replace-text-in-a-document-part.md b/docs/general/how-to-search-and-replace-text-in-a-document-part.md index eb2616a..9a73ba0 100644 --- a/docs/general/how-to-search-and-replace-text-in-a-document-part.md +++ b/docs/general/how-to-search-and-replace-text-in-a-document-part.md @@ -29,7 +29,7 @@ processing document. --------------------------------------------------------------------------------- ## Getting a WordprocessingDocument Object In the sample code, you start by opening the word processing file by -instantiating the **[WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument)** class as shown in +instantiating the **** 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 @@ -59,7 +59,7 @@ 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 **WordprocessingDocument** class in the +the 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 diff --git a/docs/general/overview.md b/docs/general/overview.md index 0aae015..0477138 100644 --- a/docs/general/overview.md +++ b/docs/general/overview.md @@ -19,7 +19,6 @@ ms.localizationpriority: high This section provides how-to topics for working with documents and packages using the Open XML SDK. - ## In this section - [Features in Open XML SDK](features.md) diff --git a/docs/word/how-to-apply-a-style-to-a-paragraph-in-a-word-processing-document.md b/docs/word/how-to-apply-a-style-to-a-paragraph-in-a-word-processing-document.md index a04e7ab..94fe5f2 100644 --- a/docs/word/how-to-apply-a-style-to-a-paragraph-in-a-word-processing-document.md +++ b/docs/word/how-to-apply-a-style-to-a-paragraph-in-a-word-processing-document.md @@ -41,7 +41,7 @@ The following sections in this topic explain the implementation of this method a ## Get a WordprocessingDocument object -The Sample Code section also shows the code required to set up for calling the sample method. To use the method to apply a style to a paragraph in a document, you first need a reference to the open document. In the Open XML SDK, the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class represents a Word document package. To open and work with a Word document, create an instance of the **WordprocessingDocument** class from the document. After you create the instance, use it to obtain access to the main document part that contains the text of the document. The content in the main document part is represented in the package as XML using WordprocessingML markup. +The Sample Code section also shows the code required to set up for calling the sample method. To use the method to apply a style to a paragraph in a document, you first need a reference to the open document. In the Open XML SDK, the class represents a Word document package. To open and work with a Word document, create an instance of the class from the document. After you create the instance, use it to obtain access to the main document part that contains the text of the document. The content in the main document part is represented in the package as XML using WordprocessingML markup. To create the class instance, call one of the overloads of the [Open()](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) method. The following sample code shows how to use the [WordprocessingDocument.Open](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) overload. The first parameter takes a string that represents the full path to the document to open. The second parameter takes a value of **true** or **false** and represents whether to open the file for editing. In this example the parameter is **true** to enable read/write access to the file. diff --git a/docs/word/how-to-change-text-in-a-table-in-a-word-processing-document.md b/docs/word/how-to-change-text-in-a-table-in-a-word-processing-document.md index 1e92cd2..d6232a1 100644 --- a/docs/word/how-to-change-text-in-a-table-in-a-word-processing-document.md +++ b/docs/word/how-to-change-text-in-a-table-in-a-word-processing-document.md @@ -23,7 +23,7 @@ This topic shows how to use the Open XML SDK for Office to programmatically chan ## Open the Existing Document -To open an existing document, instantiate the **WordprocessingDocument** class as shown in the following **using** statement. In the same statement, open the word processing file at the specified **filepath** by using the **Open** method, with the Boolean parameter set to **true** to enable editing the document. +To open an existing document, instantiate the class as shown in the following **using** statement. In the same statement, open the word processing file at the specified **filepath** by using the **Open** method, with the Boolean parameter set to **true** to enable editing the document. ### [C#](#tab/cs-0) ```csharp @@ -48,7 +48,7 @@ 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**. Because the **WordprocessingDocument** class in the Open XML SDK +object that is created or named in the **using** statement, in this case **doc**. Because the 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 diff --git a/docs/word/how-to-create-a-word-processing-document-by-providing-a-file-name.md b/docs/word/how-to-create-a-word-processing-document-by-providing-a-file-name.md index ed8c7ce..05e0f3e 100644 --- a/docs/word/how-to-create-a-word-processing-document-by-providing-a-file-name.md +++ b/docs/word/how-to-create-a-word-processing-document-by-providing-a-file-name.md @@ -23,9 +23,9 @@ Office to programmatically create a word processing document. -------------------------------------------------------------------------------- ## Creating a WordprocessingDocument Object -In the Open XML SDK, the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class represents a +In the Open XML SDK, the class represents a Word document package. To create a Word document, you create an instance -of the **WordprocessingDocument** class and +of the 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 @@ -36,7 +36,7 @@ method. Several [Create()](/dotnet/api/documentformat.openxml.packaging.wordproc 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](/dotnet/api/documentformat.openxml.wordprocessingdocumenttype) enumeration. +of the enumeration. This parameter represents the type of document. For example, there is a different member of the **WordProcessingDocumentType** enumeration for each of document, template, and the macro enabled variety of document and @@ -74,14 +74,14 @@ 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 **wordDocument**. Because the **WordprocessingDocument** class in the Open XML SDK +object that is created or named in the **using** statement, in this case **wordDocument**. Because the 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**. Once you have created the Word document package, you can add parts to -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, +it. To add the main document part you call the method of the class. Having done that, you can set about adding the document structure and text. diff --git a/docs/word/how-to-insert-a-comment-into-a-word-processing-document.md b/docs/word/how-to-insert-a-comment-into-a-word-processing-document.md index db3ebbe..02f2c21 100644 --- a/docs/word/how-to-insert-a-comment-into-a-word-processing-document.md +++ b/docs/word/how-to-insert-a-comment-into-a-word-processing-document.md @@ -24,7 +24,7 @@ word processing document. -------------------------------------------------------------------------------- ## Open the Existing Document for Editing -To open an existing document, instantiate the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class as shown in +To open an existing document, instantiate the class as shown in the following **using** statement. In the same statement, open the word processing file at the specified *filepath* by using the [Open(String, Boolean)](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) method, with the diff --git a/docs/word/how-to-insert-a-picture-into-a-word-processing-document.md b/docs/word/how-to-insert-a-picture-into-a-word-processing-document.md index d657ae0..4a17b36 100644 --- a/docs/word/how-to-insert-a-picture-into-a-word-processing-document.md +++ b/docs/word/how-to-insert-a-picture-into-a-word-processing-document.md @@ -25,7 +25,7 @@ This topic shows how to use the classes in the Open XML SDK for Office to progra ## Opening an Existing Document for Editing -To open an existing document, instantiate the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class as shown in +To open an existing document, instantiate the class as shown in the following **using** statement. In the same statement, open the word processing file at the specified **filepath** by using the [Open(String, Boolean)](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) method, with the Boolean parameter set to **true** in order to @@ -56,7 +56,7 @@ that is 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 -*wordprocessingDocument*. Because the **WordprocessingDocument** class in the Open XML SDK +*wordprocessingDocument*. Because the 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 diff --git a/docs/word/how-to-insert-a-table-into-a-word-processing-document.md b/docs/word/how-to-insert-a-table-into-a-word-processing-document.md index cc99b31..e145ca1 100644 --- a/docs/word/how-to-insert-a-table-into-a-word-processing-document.md +++ b/docs/word/how-to-insert-a-table-into-a-word-processing-document.md @@ -24,7 +24,7 @@ document. ## Getting a WordprocessingDocument Object -To open an existing document, instantiate the **WordprocessingDocument** class as shown in the +To open an existing document, instantiate the class as shown in the following **using** statement. In the same statement, open the word processing file at the specified filepath by using the **Open** method, with the Boolean @@ -55,7 +55,7 @@ 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. Because the **WordprocessingDocument** class in the Open XML SDK +the using statement, in this case doc. Because the 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 diff --git a/docs/word/how-to-open-a-word-processing-document-for-read-only-access.md b/docs/word/how-to-open-a-word-processing-document-for-read-only-access.md index f118cf7..79bdaf9 100644 --- a/docs/word/how-to-open-a-word-processing-document-for-read-only-access.md +++ b/docs/word/how-to-open-a-word-processing-document-for-read-only-access.md @@ -33,13 +33,13 @@ programmatically open a read-only word processing document. -------------------------------------------------------------------------------- ## Create a WordprocessingDocument Object -In the Open XML SDK, the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class represents a +In the Open XML SDK, the class represents a Word document package. To work with a Word document, first create an -instance of the **WordprocessingDocument** +instance of the class from the document, and then work with that instance. Once you create the instance from the document, you can then obtain access to the main document part that contains the text of the document. Every Open -XML package contains some number of parts. At a minimum, a **WordProcessingDocument** must contain a main +XML package contains some number of parts. At a minimum, a must contain a main document part that acts as a container for the main text of the document. The package can also contain additional parts. Notice that in a Word document, the text in the main document part is represented in @@ -51,10 +51,10 @@ editable are listed in the following table. Open Method|Class Library Reference Topic|Description --|--|-- -Open(String, Boolean)|[Open(String, Boolean)](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) |Create an instance of the **WordprocessingDocument** class from the specified file. -Open(Stream, Boolean)|[Open(Stream, Boolean)](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) |Create an instance of the **WordprocessingDocument** class from the specified IO stream. -Open(String, Boolean, OpenSettings)|[Open(String, Boolean, OpenSettings)](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) |Create an instance of the **WordprocessingDocument** class from the specified file. -Open(Stream, Boolean, OpenSettings)|[Open(Stream, Boolean, OpenSettings)](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) |Create an instance of the **WordprocessingDocument** class from the specified I/O stream. +Open(String, Boolean)|[Open(String, Boolean)](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) |Create an instance of the class from the specified file. +Open(Stream, Boolean)|[Open(Stream, Boolean)](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) |Create an instance of the class from the specified IO stream. +Open(String, Boolean, OpenSettings)|[Open(String, Boolean, OpenSettings)](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) |Create an instance of the class from the specified file. +Open(Stream, Boolean, OpenSettings)|[Open(Stream, Boolean, OpenSettings)](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) |Create an instance of the class from the specified I/O stream. The table above lists only those **Open** methods that accept a Boolean value as the second parameter to specify @@ -62,7 +62,7 @@ whether a document is editable. To open a document for read only access, you specify false for this parameter. Notice that two of the **Open** methods create -an instance of the **WordprocessingDocument** +an instance of the class based on a string as the first parameter. The first example in the sample code uses this technique. It uses the first **Open** method in the table above; with a signature that requires two parameters. The first parameter takes a string that @@ -90,7 +90,7 @@ Method. The other two **Open** methods create an -instance of the **WordprocessingDocument** +instance of the class based on an input/output stream. You might employ this approach, for instance, if you have a Microsoft SharePoint Foundation 2010 application that uses stream input/output, and you want to use the Open @@ -123,7 +123,7 @@ that takes a Boolean as the second parameter to indicate whether the document should be opened for editing. The recommended method is to open the package read-only to begin with -prior to creating the instance of the **WordprocessingDocument** class, as shown in the +prior to creating the instance of the class, as shown in the second example in the sample code. The following code example performs this operation. diff --git a/docs/word/how-to-open-a-word-processing-document-from-a-stream.md b/docs/word/how-to-open-a-word-processing-document-from-a-stream.md index bbc8823..729c644 100644 --- a/docs/word/how-to-open-a-word-processing-document-from-a-stream.md +++ b/docs/word/how-to-open-a-word-processing-document-from-a-stream.md @@ -37,13 +37,13 @@ adds text to the document behind the stream using the Open XML SDK. ## Creating a WordprocessingDocument Object -In the Open XML SDK, the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class represents a +In the Open XML SDK, the class represents a Word document package. To work with a Word document, first create an -instance of the **WordprocessingDocument** +instance of the class from the document, and then work with that instance. When you create the instance from the document, you can then obtain access to the main document part that contains the text of the document. Every Open -XML package contains some number of parts. At a minimum, a **WordProcessingDocument** must contain a main +XML package contains some number of parts. At a minimum, a must contain a main document part that acts as a container for the main text of the document. The package can also contain additional parts. Notice that in a Word document, the text in the main document part is represented in diff --git a/docs/word/how-to-open-and-add-text-to-a-word-processing-document.md b/docs/word/how-to-open-and-add-text-to-a-word-processing-document.md index eb2dd7c..b18ef6d 100644 --- a/docs/word/how-to-open-and-add-text-to-a-word-processing-document.md +++ b/docs/word/how-to-open-and-add-text-to-a-word-processing-document.md @@ -34,9 +34,9 @@ elements, and their corresponding Open XML SDK classes. -------------------------------------------------------------------------------- ## Create a WordprocessingDocument Object -In the Open XML SDK, the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class represents a +In the Open XML SDK, the class represents a Word document package. To open and work with a Word document, create an -instance of the **WordprocessingDocument** +instance of the class from the document. When you create the instance from the document, you can then obtain access to the main document part that contains the text of the document. The text in the main document part is represented diff --git a/docs/word/how-to-remove-hidden-text-from-a-word-processing-document.md b/docs/word/how-to-remove-hidden-text-from-a-word-processing-document.md index 38b3c32..718ab2e 100644 --- a/docs/word/how-to-remove-hidden-text-from-a-word-processing-document.md +++ b/docs/word/how-to-remove-hidden-text-from-a-word-processing-document.md @@ -24,7 +24,7 @@ document. --------------------------------------------------------------------------------- ## Getting a WordprocessingDocument Object -To open an existing document, you instantiate the **WordprocessingDocument** class as shown in the +To open an existing document, you instantiate the class as shown in the following **using** statement. In the same statement, you open the word processing file with the specified *fileName* by using the **Open** method, with @@ -56,7 +56,7 @@ 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. Because the **WordprocessingDocument** class in the Open XML SDK +the using statement, in this case doc. Because the 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 diff --git a/docs/word/how-to-retrieve-application-property-values-from-a-word-processing-document.md b/docs/word/how-to-retrieve-application-property-values-from-a-word-processing-document.md index c5448c1..56340af 100644 --- a/docs/word/how-to-retrieve-application-property-values-from-a-word-processing-document.md +++ b/docs/word/how-to-retrieve-application-property-values-from-a-word-processing-document.md @@ -24,7 +24,7 @@ This topic shows how to use the classes in the Open XML SDK for Office to progra ## Retrieving Application Properties -To retrieve application document properties, you can retrieve the **ExtendedFilePropertiesPart** property of a **WordprocessingDocument** object, and then retrieve the specific application property you need. To do this, you must first get a reference to the document, as shown in the following code. +To retrieve application document properties, you can retrieve the **ExtendedFilePropertiesPart** property of a object, and then retrieve the specific application property you need. To do this, you must first get a reference to the document, as shown in the following code. ### [C#](#tab/cs-0) ```csharp @@ -49,7 +49,7 @@ To retrieve application document properties, you can retrieve the **ExtendedFile *** -Given the reference to the **WordProcessingDocument** object, you can retrieve a reference to the **ExtendedFilePropertiesPart** property of the document. This object provides its own properties, each of which exposes one of the application document properties. +Given the reference to the object, you can retrieve a reference to the **ExtendedFilePropertiesPart** property of the document. This object provides its own properties, each of which exposes one of the application document properties. ### [C#](#tab/cs-1) ```csharp diff --git a/docs/word/how-to-retrieve-comments-from-a-word-processing-document.md b/docs/word/how-to-retrieve-comments-from-a-word-processing-document.md index 2d52a5b..fc063dd 100644 --- a/docs/word/how-to-retrieve-comments-from-a-word-processing-document.md +++ b/docs/word/how-to-retrieve-comments-from-a-word-processing-document.md @@ -24,7 +24,7 @@ part in a word processing document. -------------------------------------------------------------------------------- ## Open the Existing Document for Read-only Access -To open an existing document, instantiate the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class as shown in +To open an existing document, instantiate the class as shown in the following **using** statement. In the same statement, open the word processing file at the specified **fileName** by using the [Open(String, Boolean)](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) method. To open the file for editing the Boolean parameter is set to **true**. In this example you just need to read the diff --git a/docs/word/how-to-set-a-custom-property-in-a-word-processing-document.md b/docs/word/how-to-set-a-custom-property-in-a-word-processing-document.md index 928192a..cd601cb 100644 --- a/docs/word/how-to-set-a-custom-property-in-a-word-processing-document.md +++ b/docs/word/how-to-set-a-custom-property-in-a-word-processing-document.md @@ -323,7 +323,7 @@ At this point, if the code has not thrown an exception, you can assume that the ## Working with the Document Given the **CustomDocumentProperty** object, the code next interacts with the document that you supplied in the parameters to the **SetCustomProperty** procedure. The code starts by opening the document in read/write mode by -using the [Open](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) method of the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) class. The code attempts to retrieve a reference to the custom file properties part by using the [CustomFilePropertiesPart](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.customfilepropertiespart) property of the document. +using the [Open](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.open) method of the class. The code attempts to retrieve a reference to the custom file properties part by using the [CustomFilePropertiesPart](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument.customfilepropertiespart) property of the document. ### [C#](#tab/cs-5) ```csharp diff --git a/docs/word/how-to-set-the-font-for-a-text-run.md b/docs/word/how-to-set-the-font-for-a-text-run.md index ecdc934..f4912f3 100644 --- a/docs/word/how-to-set-the-font-for-a-text-run.md +++ b/docs/word/how-to-set-the-font-for-a-text-run.md @@ -111,7 +111,7 @@ In this case, running the code sample produces an in-memory XML structure where the **RunProperties** element is added as the first child element of the **Run** element. It then saves the changes back to the [Save(MainDocumentPart)](/dotnet/api/documentformat.openxml.wordprocessing.document.save) object. Calling the -**Save** method of the [WordprocessingDocument](/dotnet/api/documentformat.openxml.packaging.wordprocessingdocument) object commits +**Save** method of the object commits changes made to the in-memory representation of the **MainDocumentPart** part back into the XML file for the **MainDocumentPart** (the document.xml file in the Wordprocessing package). diff --git a/docs/word/overview.md b/docs/word/overview.md index 2a23d16..26cf33b 100644 --- a/docs/word/overview.md +++ b/docs/word/overview.md @@ -65,7 +65,7 @@ This section provides how-to topics for working with word processing documents u - [Retrieve comments from a word processing document](how-to-retrieve-comments-from-a-word-processing-document.md) -- [Retrieve property values from a Word document by using the Open XML API](/office/open-xml/how-to-retrieve-application-property-values-from-a-word-processing-document) +- [Retrieve property values from a Word document by using the Open XML API](how-to-retrieve-application-property-values-from-a-word-processing-document.md) - [Set a custom property in a word processing document](how-to-set-a-custom-property-in-a-word-processing-document.md)