Esempio n. 1
0
        public virtual bool IsValidExcel(byte[] xlsBuffer, ExcelMetadata metadata)
        {
            var workbook = new Workbook(new MemoryStream(xlsBuffer));
            var property = workbook.BuiltInDocumentProperties;

            return(metadata.Keywords == property.Keywords || property.Keywords == "exportExcel"); //或从平台导出的
            //&& metadata.RevisionNumber == metadata.RevisionNumber
            //&& metadata.Author == property.Author
            //&& metadata.Company == property.Company;
        }
Esempio n. 2
0
        public virtual ExcelMetadata GetMetadataByPath(string path)
        {
            var fileBuffer = GetExcelTemplateFile(path);
            var workbook   = new Workbook(new MemoryStream(fileBuffer));
            var property   = workbook.BuiltInDocumentProperties;
            var metadata   = new ExcelMetadata
            {
                Author         = property.Author,
                Company        = property.Company,
                Keywords       = property.Keywords,
                RevisionNumber = property.RevisionNumber,
                FileBuffer     = fileBuffer,
            };

            workbook = null;
            return(metadata);
        }