ShapeBase elements: Pictures and Shapes

Coming soon in April 2018...

Complete code

using SautinSoft;
            Imports System
Imports SautinSoft.Document

Module ExampleVB

    Sub Main()
    End Sub

    Public Sub CreateRtf()
        ' Set a path to our rtf file.
        Dim rtfPath As String = "d:\Result.rtf"

        ' Let's create a simple Rtf document.
        Dim rtf As New DocumentCore()
        'DocumentCore.Serial = "put your serial here";

        ' Add new section.
        Dim section As New Section(rtf)

        ' Let's set page size A4.
        section.PageSetup.PaperType = PaperType.A4

        ' Add two paragraphs using different ways:

        ' Way 1: Add 1st paragraph.
        Dim par1 As New Paragraph(rtf)
        par1.ParagraphFormat.Alignment = HorizontalAlignment.Center

        ' Let's create a characterformat for text in the 1st paragraph.
        Dim cf As New CharacterFormat() With {
        .FontName = "Verdana",
        .Size = 16,
        .FontColor = Color.Orange

        Dim text1 As New Run(rtf, "This is a first line in 1st paragraph!")
        text1.CharacterFormat = cf

        ' Let's add a line break into our paragraph.
        par1.Inlines.Add(New SpecialCharacter(rtf, SpecialCharacterType.LineBreak))

        Dim text2 As Run = text1.Clone()
        text2.Text = "Let's type a second line."

        ' Way 2 (easy): Add 2nd paragraph using ContentRange.
        rtf.Content.End.Insert(ControlChars.Lf & "This is a first line in 2nd paragraph.", New CharacterFormat() With {
        .Size = 25,
        .FontColor = Color.Blue,
        .Bold = True
        Dim lBr As New SpecialCharacter(rtf, SpecialCharacterType.LineBreak)
        rtf.Content.End.Insert("This is a second line.", New CharacterFormat() With {
        .Size = 20,
        .FontColor = Color.DarkGreen,
        .UnderlineStyle = UnderlineType.Single

        ' Save Rtf to a file
        rtf.Save(rtfPath, New RtfSaveOptions())
    End Sub
End Module
© SautinSoft 2020