Md2Word.vb
''
'' This code is part of Document Solutions for Word demos.
'' Copyright (c) MESCIUS inc. All rights reserved.
''
Imports System.IO
Imports System.Drawing
Imports System.Collections.Generic
Imports System.Linq
Imports GrapeCity.Documents.Word

Public Class Md2Word
    Function CreateDocx(sampleParams As String()) As GcWordDocument
        Dim fn = Path.Combine(sampleParams(3).Split("/"c))
        Dim markdown = File.ReadAllText(fn)
        Return WordRenderer.ToWord(markdown)
    End Function

    Function CreateDocx(Optional parsIdx As Integer = 0) As GcWordDocument
        Return CreateDocx(GetSampleParamsList()(parsIdx))
    End Function

    Private Shared ReadOnly s_paramsList As New List(Of String())() From {
        New String() {"@md/DsPdfViewer README.md", "Convert the README.md file shipped with DsPdfViewer", Nothing,
            "Resources/Markdown/DsPdfViewer-README.md"},
        New String() {"@md/DsPdfViewer CHANGELOG.md", "Convert the CHANGELOG.md file shipped with DsPdfViewer", Nothing,
            "Resources/Markdown/DsPdfViewer-CHANGELOG.md"},
        New String() {"@md/spec.md", "Convert the Markdown specification spec.md file", Nothing,
            "Resources/Markdown/spec.md"}
    }

    Public Shared Function GetSampleParamsList() As List(Of String())
        Return s_paramsList
    End Function
End Class