V
V
vitvov2015-04-03 15:43:17
Project management
vitvov, 2015-04-03 15:43:17

How to export program text to word?

According to the contract, you need to provide the program code in text form. What are the ways, programs or plugins to automatically reset all code to text. The code is written in C# in Visual Studio 2010.
UPD
Resolved:
In general, I did as GavriKos recommends , namely, I wrote a script. If anyone else encounters the problem, here is the code for the solution.

private void Export(string sourceDirectory, string destinationPath)
{
    //  parse files
    var files = Directory.GetFiles(sourceDirectory);
    foreach (var file in files)
    {
        var extension = Path.GetExtension(file);
        if (extension == null) 
            continue;
        switch (extension.ToLower())
        {
            case ".cs":
                var text = File.ReadAllText(file);
                //
                using (var fs = new FileStream(destinationPath, FileMode.Append, FileAccess.Write))
                {
                    using (var sw = new StreamWriter(fs))
                    {
                        sw.WriteLine(Path.GetFileName(file));
                        sw.WriteLine();
                        sw.WriteLine(text);
                        sw.WriteLine();
                        sw.WriteLine();
                        sw.WriteLine();
                    }
                }
                        
                break;
        }
    }

    //  parse directory
    var directoryes = Directory.GetDirectories(sourceDirectory);
    foreach (var dir in directoryes)
    {
        Export(dir, destinationPath);
    }
}

Use:
var dialog = new FolderBrowserDialog();
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
    var path = dialog.SelectedPath;
    Export(path, string.Format("{0}\\code.txt", path));
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2015-04-03
@vitvov

Under the contract, it is enough to transfer the source code of the project.
UPD1: To prepare in a documented form doxygen to help.

A
Armenian Radio, 2015-04-03
@gbg

Print. Then print on each page. Then scan to PDF and submit.
Seriously, what's stopping you from naturally giving a snapshot of the sources?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question