Example #1
0
        static void Main(string[] args)
        {
            string markdown = File.ReadAllText(@".\test.txt");
            string saveTo   = @".\Test.docx";

            MD2OXML.CreateDocX(markdown, saveTo);
            Process.Start(saveTo);
        }
Example #2
0
        static void Main(string[] args)
        {
            for (int i = 0; i < args.Length; i++)
            {
                switch (args[i])
                {
                case "-i":
                    if (i + 1 >= args.Length || args[i + 1].StartsWith("-"))
                    {
                        Console.WriteLine("Argument required for -i");
                        return;
                    }
                    inputFile = args[++i];
                    break;

                case "-o":
                    if (i + 1 >= args.Length || args[i + 1].StartsWith("-"))
                    {
                        Console.WriteLine("Argument required for -o");
                        return;
                    }
                    outputFile = args[++i];
                    break;

                default:
                    Console.WriteLine("argument {0} not understood", args[i]);
                    break;
                }
            }

            while (!File.Exists(inputFile))
            {
                Console.WriteLine("Please provide a path to an existing Markdown file:");
                inputFile = Console.ReadLine();
            }

            string md = System.IO.File.ReadAllText(inputFile);

            if (outputFile == null)
            {
                Console.WriteLine("");
                Console.WriteLine("Please provide the path for the output destination:");
                outputFile = Console.ReadLine();
            }
            MD2OXML.CreateDocX(md, outputFile);
        }
Example #3
0
 private void save_Click(object sender, EventArgs e)
 {
     MD2OXML.CreateDocX(markdown.Text, file.Text);
     Process.Start(file.Text);
 }