public PersonFiles[] SplitExcel(string docName, byte[] docFile, byte[] xmlFile) { ISplit run = new ExcelSplit(docName); MemoryStream doc = new MemoryStream(docFile); MemoryStream xml = new MemoryStream(xmlFile); run.OpenAndSearchDocument(doc, xml); return(run.SaveSplitDocument(doc).ToArray()); }
public ServiceResponse GetExcelPartsFromXml(string docName, byte[] documentFile, byte[] splitFile) { ISplitXml split = new ExcelSplit(Path.GetFileNameWithoutExtension(docName)); var cleanParts = GetExcelParts(docName, documentFile); try { return(new ServiceResponse(split.SelectPartsFromSplitXml(new MemoryStream(splitFile), cleanParts))); } catch (SplitNameDifferenceExcception ex) { return(new ServiceResponse(ex.Message)); } }
public void Init() { var excelSplit = new ExcelSplit("ExcelTutorialR1 — edytowalny"); ExcSampleSplit = excelSplit; SplitXml = excelSplit; ExcSampleMerge = excelSplit; DocValidator = new OpenXmlValidator(); var parts = PartsSelectionTreeElementMock.GetListMock(); CreateSplitXmlBinary = SplitXml.CreateSplitXml(parts); ExcSampleDocInMemory = new MemoryStream(File.ReadAllBytes(@"../../../Files/ExcelTutorialR1 — edytowalny.xlsx")); byte[] sampleXmlBinary = File.ReadAllBytes(@"../../../Files/split_ExcelTutorialR1 — edytowalny.xlsx_20170304230639351.xml"); excelSplit.OpenAndSearchDocument(ExcSampleDocInMemory, new MemoryStream(sampleXmlBinary)); MergeXmlBinary = ExcSampleMerge.CreateMergeXml(); ErrorsCount = 0; WarningsCount = 0; }
public byte[] GenerateSplitExcel(string docName, PartsSelectionTreeElement[] parts) { ISplitXml split = new ExcelSplit(docName); return(split.CreateSplitXml(parts)); }