Ejemplo n.º 1
0
        private void MergeButton_Click(object sender, RoutedEventArgs e)
        {
            this.FilePaths = new List <string>(FolderSearch.GetAllFilePaths(this.PathTextBox.Text));
            Docs   docs   = new Docs(this.FilePaths);
            string output = @"C:\Users\1\Desktop\DocsMergerTest\merged.docx";

            //Merger.MergeOdt(docs, output);
            Merger.Merge(FilePaths.ToArray(), output, true, output);
            this.StatusLabel.Content = "Merging complete";
        }
Ejemplo n.º 2
0
        public static void MergeOdt(Docs docs, string outputfilepath)
        {
            List <string>       filepaths     = new List <string>(docs.GetList());
            TextDocument        temp          = new TextDocument(outputfilepath);
            List <TextDocument> textdocuments = ListToTextDocuments(filepaths);

            for (int i = 0; i < textdocuments.Count; i++)
            {
                IList <ITextContent> textContents = textdocuments[i].Body.Content;

                foreach (var content in textContents)
                {
                    temp.Body.Add(content);
                }
            }

            temp.Save(outputfilepath, true);
        }
Ejemplo n.º 3
0
        public static void MergeTxt(Docs docs, string resultfilepath)
        {
            List <string> inputfilespaths = docs.GetList();
            StreamReader  sr;
            StreamWriter  sw;
            string        text = String.Empty;

            for (int i = 0; i < inputfilespaths.Count; i++)
            {
                sr   = File.OpenText(inputfilespaths[i]);
                text = String.Empty;
                text = sr.ReadToEnd();
                sw   = File.AppendText(resultfilepath);
                sw.WriteLine(text);
                sw.Close();
                Console.WriteLine(text);
            }
        }