public PersonFiles[] SplitWord(string docName, byte[] docxFile, byte[] xmlFile)
        {
            ISplit       run = new WordSplit(docName);
            MemoryStream doc = new MemoryStream(docxFile);
            MemoryStream xml = new MemoryStream(xmlFile);

            run.OpenAndSearchDocument(doc, xml);

            return(run.SaveSplitDocument(doc).ToArray());
        }
Esempio n. 2
0
        public void WordSplitSimpleTest()
        {
            HashSet <string> words = new HashSet <string>();

            words.Add("A");
            words.Add("AM");
            words.Add("ACE");
            words.Add("I");
            var wordSplit = new WordSplit();

            Console.WriteLine(wordSplit.IsSplitable("IAMACE".ToCharArray().ToList(), words));
        }
        public ServiceResponse GetWordPartsFromXml(string docName, byte[] documentFile, byte[] splitFile)
        {
            ISplitXml split      = new WordSplit(Path.GetFileNameWithoutExtension(docName));
            var       cleanParts = GetWordParts(docName, documentFile);

            try
            {
                return(new ServiceResponse(split.SelectPartsFromSplitXml(new MemoryStream(splitFile), cleanParts)));
            }
            catch (SplitNameDifferenceExcception ex)
            {
                return(new ServiceResponse(ex.Message));
            }
        }
Esempio n. 4
0
        public void Init()
        {
            var wordSplit = new WordSplit("demo");

            WordSampleMerge = wordSplit;
            WordSampleSplit = wordSplit;
            SplitXml        = wordSplit;

            DocValidator = new OpenXmlValidator();

            var parts = PartsSelectionTreeElementMock.GetListMock();

            CreateSplitXmlBinary = SplitXml.CreateSplitXml(parts);

            WordSampleDocInMemory = new MemoryStream(File.ReadAllBytes(@"../../../Files/demo.docx"));

            byte[] sampleXmlBinary = File.ReadAllBytes(@"../../../Files/split_demo.docx_20170227215840894.xml");
            wordSplit.OpenAndSearchDocument(WordSampleDocInMemory, new MemoryStream(sampleXmlBinary));

            MergeXmlBinary = WordSampleMerge.CreateMergeXml();

            ErrorsCount   = 0;
            WarningsCount = 0;
        }
        public byte[] GenerateSplitWord(string docName, PartsSelectionTreeElement[] parts)
        {
            ISplitXml split = new WordSplit(docName);

            return(split.CreateSplitXml(parts));
        }
Esempio n. 6
0
 static void Main(string[] args)
 {
     WordSplit c = new WordSplit();
     string word = "cabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabca";
     object o = c.pieces(word);
     PrintObj(o, 0);
     System.Console.In.ReadLine();
 }