Public Sub ApplyStyleToParagraph(ByVal doc As WordprocessingDocument,īyVal styleid As String, ByVal stylename As String, ByVal p As Paragraph) public static void ApplyStyleToParagraph(WordprocessingDocument doc, string styleid, string stylename, Paragraph p) The method accepts four parameters that indicate: the reference to the opened word processing document, the styleid of the style to be applied, the name of the style to be applied, and the reference to the paragraph to which to apply the style. You must first obtain a reference to the document as well as a reference to the paragraph that you want to style. The ApplyStyleToParagraph example method can be used to apply a style to a paragraph. You must also use the following using directives or Imports statements to compile the code in this topic. DocumentFormat.OpenXml (installed by the Open XML SDK).You must explicitly reference the following assemblies in your project: To use the sample code in this topic, you must install the Open XML SDK 2.5. It contains an example ApplyStyleToParagraph method to illustrate this task, plus several supplemental example methods to check whether a style exists, add a new style, and add the styles part. This topic shows how to use the classes in the Open XML SDK 2.5 for Office to programmatically apply a style to a paragraph within a word processing document.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |