- #HOW DO I DELETE A FOLDER IN MICROSOFT OPEN XML CONVERTER HOW TO#
- #HOW DO I DELETE A FOLDER IN MICROSOFT OPEN XML CONVERTER CODE#
#HOW DO I DELETE A FOLDER IN MICROSOFT OPEN XML CONVERTER CODE#
The following code removes a document part from a package. MainPart.DeletePart(mainPart.DocumentSettingsPart) If mainPart.DocumentSettingsPart IsNot Nothing Then MainPart.DeletePart(mainPart.DocumentSettingsPart) ĭim mainPart As MainDocumentPart = wordDoc.MainDocumentPart If (mainPart.DocumentSettingsPart != null) MainDocumentPart mainPart = wordDoc.MainDocumentPart You can then check if that part exists, if so, delete that part from the Reference to the DocumentSettingsPart part. How the Sample Code WorksĪfter you have opened the document, in the using statement, as a WordprocessingDocument object, you create a White space compression using the characterSpacingControl element. In this case, the two settings applied areĪutomatic tab stop increments of 0.5" using the defaultTabStop element, and no character level Example:Ĭonsider the following WordprocessingML fragment for the settings part This element is the root element of theĭocument Settings part in a WordprocessingML document. This element specifies the settings that are applied to a Introduces the settings element in a PresentationML package. The container for the block level structures such as paragraphs, tables, annotations, and others specified in the ISO/IEC 29500 specification. The root element for the main document part. The following table lists the class names of the classes thatĬorrespond to the document, body, p, r, and t elements. Using the Open XML SDK 2.5, you can create document structure andĬontent using strongly-typed classes that correspond to WordprocessingML elements. Ĭreate text in body - CreateWordprocessingDocument Sample code creates is shown in the following code example. The WordprocessingML markup for the document that the The r stands for run, which is a region of text withĪ common set of properties, such as formatting. A paragraphĬontains one or more r elements. The basic document structure of a WordProcessingML document consists of the document and bodyĮlements, followed by one or more block level elements such as p, which represents a paragraph. Basic Structure of a WordProcessingML Document When you exit the block you do not have to explicitly call Save and Close─as The Dispose method is automatically called Because the WordprocessingDocument class in the Open XML SDKĪutomatically saves and closes the object as part of its System.IDisposable implementation, and because Object that is created or named in the using statement, in this case wordDoc. The block that follows the using statement establishes a scope for the Used by the Open XML SDK to clean up resources) is automatically called The using statement provides a recommendedĪlternative to the typical. Using wordDoc As WordprocessingDocument = WordprocessingDocument.Open(document, True) ' Open a Wordprocessing document for editing.
Using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(document, true)) Open a Wordprocessing document for editing. Should be opened in read/write mode or not. That takes a string and a Boolean value that specifies whether the file Name as an argument to one of the overloaded Open() methods of the The code example starts with opening a package file by passing a file In this how-to topic, you will useĪ word-processing document package. Package-relationship item contains a relationship to a workbook part, it Presentation part it can be defined as a presentation document. If its package-relationship item contains a relationship to a Package-relationship item contains a relationship to a main document Aĭocument can be defined as a word-processing document if its Relationship between parts controls the category of the document.
Package can have multiple parts with relationships between them. The following assembly directives are required to compile the code inĪn Open XML document is stored as a package, whose format is defined by Office to remove a document part (file) from a Wordprocessing document
#HOW DO I DELETE A FOLDER IN MICROSOFT OPEN XML CONVERTER HOW TO#
This topic shows how to use the classes in the Open XML SDK 2.5 for