Acceleratio.SPDG.Generator.SampleData.CreateDocx C# (CSharp) Method

CreateDocx() public static method

public static CreateDocx ( ) : byte[]
return byte[]
        public static byte[] CreateDocx()
        {
            string text = File.ReadAllText("SampleData\\document.xml");
            text = text.Replace("SPDGTitle", SampleData.GetSampleValueRandom ( SampleData.BusinessDocsTypes) );
            text = text.Replace("SPDGDate", "Date: " + SampleData.GetRandomDate(1990, 2015).ToShortDateString());
            text = text.Replace("SPDGUser", "Author: " + SampleData.GetSampleValueRandom(SampleData.FirstNames) + " " + SampleData.GetSampleValueRandom(SampleData.LastNames));
            text = text.Replace("SPDGIdentity", "ID: " + SampleData.GetRandomNumber(100000, 1000000).ToString());

            string lorem = File.ReadAllText("SampleData\\loreIpsum.txt");
            text = text.Replace("SPDGLoreIpsum", getMultipleLoremIpsum(lorem, 1));

            File.WriteAllText("SampleData\\SampleDocx\\word\\document.xml", text);

            string path = "SampleData\\SampleDocx";
            using (ZipFile zip = new ZipFile())
            {
                zip.AddFile(path + "\\[Content_Types].xml", string.Empty);
                zip.AddFile(path + "\\_rels\\.rels", "_rels");
                zip.AddFile(path + "\\docProps\\app.xml", "docProps");
                zip.AddFile(path + "\\docProps\\core.xml", "docProps");
                zip.AddFile(path + "\\word\\_rels\\document.xml.rels", "word\\_rels");
                zip.AddFile(path + "\\word\\theme\\theme1.xml", "word\\theme");
                zip.AddFile(path + "\\word\\document.xml", "word");
                zip.AddFile(path + "\\word\\fontTable.xml", "word");
                zip.AddFile(path + "\\word\\settings.xml", "word");
                zip.AddFile(path + "\\word\\styles.xml", "word");
                zip.AddFile(path + "\\word\\webSettings.xml", string.Empty);

                zip.Comment = "This zip was created at " + System.DateTime.Now.ToString("G");

                MemoryStream stream = new MemoryStream();
                zip.Save(stream);

                byte[] bytes = new byte[stream.Length];
                bytes = stream.ToArray();
                stream.Close();

                return bytes;
            }
        }