These are chat archives for chat-rooms/programming

22nd
May 2016
Anders Nicolai Magnussen
@andersnicolaimagnussen
May 22 2016 14:43
Hi Guys, this is a really stupid question, I have not programmed in a while and are doing some C#
How do I call my public class, to kick off the program from main?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using Novacode;

namespace ConsoleApplication18
{
class Program
{
static void Main(string[] args)
{
// What do i Write here?
}

    public class DocX_Examples
    {
        public void CreateSampleDocument()
        {
            // Modify to suit your machine:
            string fileName = @"C:\Users\johndoe\Documents\sample\DocXExample.docx";

            // Create a document in memory:
            var doc = DocX.Create(fileName);

            // Insert a paragraph:
            doc.InsertParagraph("This is my first paragraph");

            // Save to the output directory:
            doc.Save();

            // Open in Word:
            Process.Start("WINWORD.EXE", fileName);
        }
    }
}

}

Konstantin Tarkus
@koistya
May 22 2016 14:48
@nicolaimagnussen try this:
var doc = new DocX_Examples();
dc.CreateSampleDocument();
Anders Nicolai Magnussen
@andersnicolaimagnussen
May 22 2016 19:57
that worked, thanks alot
I'am now reading Head First C# So I don't need to post stupid questions like this.