AppendText ( "A new paragraph style is created and is applied to this paragraph." ) //Applies the new style to paragraph paragraph. AddParagraph () IWTextRange text = paragraph. Italic = true //Adds new paragraph to the section IWParagraph paragraph = section. AddParagraphStyle ( "User_defined_style" ) style. AddSection () //Creates user defined style IWParagraphStyle style = document. Creates a new Word document WordDocument document = new WordDocument () //Adds new section to the document IWSection section = document. The following code example explains how to use the predefined styles. You can reduce the file size and code length by using styles instead of formatting each element explicitly. You can define a custom style or modify any built-in style to the required formatting, and apply this style to the part of Word document to be formatted. DocIO supports various pre-defined styles and also provides ability to create custom paragraph styles. Paragraph style contains definition for both font (text) and paragraph formatting that can be applied to the contents of an entire paragraph. You can download a complete working sample from GitHub. Paragraphs ( 6 ) 'Apply keep with next property to the paragraph. Keep = True 'Access the paragraph in a Word document. Paragraphs ( 7 ) 'Apply keep lines together property to the paragraph. Right 'Access the paragraph in a Word document. HorizontalAlignment = HorizontalAlignment. Paragraphs ( 4 ) 'Apply paragraph formatting. Sections ( 0 ) 'Access the paragraph in a Word document. Docx ) 'Access the section in a Word document. Using document As WordDocument = New WordDocument ( "Input.docx", FormatType. using ( FileStream docStream = new FileStream ( "Input.docx", FileMode. Negative value for this property denotes the hanging indent and positive value denotes the first line indent of the paragraph. The FirstLineIndent can be used to update or retrieve both hanging and first line indents. The following code example explains how to apply formatting to a paragraph. Applying paragraph formattingĪs in the Microsoft Word, DocIO provides support for all the paragraph formatting options such as line spacing, indentation, spacing before and after, keep follow, and more. Bold = True Exit For End If Next 'Saves the Word document document. ChildEntities If TypeOf item Is WTextRange Then Dim text As WTextRange = Tr圜ast ( item, WTextRange ) 'Modifies the character format of the text text. Paragraphs ( 1 ) 'Iterates through the child elements of paragraph For Each item As ParagraphItem In paragraph. Body 'Gets the paragraph at index 1 Dim paragraph As WParagraph = textBody. 'Loads the template document Dim document As New WordDocument ( "Template.docx" ) 'Gets the text body of first section Dim textBody As WTextBody = document. The following code example explains how to add a new paragraph. Footnotes and Endnotes: Represented by an instance of WFootnote.Bookmarks: Represented by instances of BookmarkStart and BookmarkEnd.Form Fields: Represented by an instance of WFormField.Fields: Represented by an instance of WField.Chart: Represented by an instance of WChart.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |