public static void ExportExcelFile([NotNull] this ResourceManager resourceManager, [NotNull] string filePath, [CanBeNull] IResourceScope scope, ExcelExportMode exportMode)
        {
            if (exportMode == ExcelExportMode.Text)
            {
                ExportToText(filePath, scope ?? new FullScope(resourceManager.ResourceEntities));
                return;
            }

            using (var package = SpreadsheetDocument.Create(filePath, SpreadsheetDocumentType.Workbook))
            {
                var workbookPart = package.AddWorkbookPart();

                GeneratedCode.GeneratedClass.AddStylesToWorkbookPart(workbookPart);

                if (exportMode == ExcelExportMode.MultipleSheets)
                {
                    ExportToMultipleSheets(resourceManager, workbookPart, scope);
                }
                else
                {
                    ExportToSingleSheet(workbookPart, scope ?? new FullScope(resourceManager.ResourceEntities));
                }
            }
        }
Esempio n. 2
0
        public void ExportExcel([NotNull] string filePath, [CanBeNull] object entries, [CanBeNull] object languages, [CanBeNull] object comments, ExcelExportMode exportMode)
        {
            var resourceScope = new ResourceScope(
                entries ?? ResourceManager.TableEntries,
                languages ?? ResourceManager.Cultures,
                comments ?? Array.Empty <object>());

            ResourceManager.ExportExcelFile(filePath, resourceScope, exportMode);
        }
        public static void ExportExcelFile([NotNull] this ResourceManager resourceManager, [NotNull] string filePath, [CanBeNull] IResourceScope scope, ExcelExportMode exportMode)
        {
            Contract.Requires(resourceManager != null);
            Contract.Requires(filePath != null);

            if (exportMode == ExcelExportMode.Text)
            {
                ExportToText(filePath, scope ?? new FullScope(resourceManager.ResourceEntities));
                return;
            }

            using (var package = SpreadsheetDocument.Create(filePath, SpreadsheetDocumentType.Workbook))
            {
                Contract.Assume(package != null);

                var workbookPart = package.AddWorkbookPart();
                Contract.Assume(workbookPart != null);

                if (exportMode == ExcelExportMode.MultipleSheets)
                {
                    ExportToMultipleSheets(resourceManager, workbookPart, scope);
                }
                else
                {
                    ExportToSingleSheet(workbookPart, scope ?? new FullScope(resourceManager.ResourceEntities));
                }
            }
        }
Esempio n. 4
0
        public void ExportExcel([NotNull] string filePath, [CanBeNull] object entries, [CanBeNull] object languages, [CanBeNull] object comments, ExcelExportMode exportMode)
        {
            Contract.Requires(filePath != null);

            var resourceScope = new ResourceScope(
                entries ?? _resourceManager.TableEntries,
                languages ?? _resourceManager.Cultures,
                comments ?? new object[0]);

            _resourceManager.ExportExcelFile(filePath, resourceScope, exportMode);
        }
 public ScheduleExporterExcel(List <MachineSchedule> schedules, FileInfo fileInfo, ExcelExportMode excelExportMode) : base(schedules, fileInfo)
 {
     _excelExportMode = excelExportMode;
     _package         = new ExcelPackage();
 }