Пример #1
0
        /// <summary>
        /// Updates the Ui after user set the changes
        /// </summary>
        /// <param name="settings"></param>
        public void UpdateUi(GeneratorSettings settings)
        {
            _settings = settings;
            switch (_settings.ExcludeExportType)
            {
            case GeneratorSettings.ExclusionType.Category:
                rb_ExcludeCategory.Checked = true;
                break;

            case GeneratorSettings.ExclusionType.Status:
                rb_ExcludeStatus.Checked = true;
                break;

            case GeneratorSettings.ExclusionType.Locked:
                excludeLockedBtn.Checked = true;
                break;

            default:
                break;
            }
            cbl_ExcludedStatuses.Items.Clear();
            AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.ApprovedSignOff));
            AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.ApprovedTranslation));
            AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.Draft));
            AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.RejectedSignOff));
            AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.RejectedTranslation));
            AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.Translated));
            AddSegmentStatusItem(new SegmentStatus(Sdl.Core.Globalization.ConfirmationLevel.Unspecified));

            cb_DontExportContext.Checked = _settings.DontExportContext;
            cb_DontExportExact.Checked   = _settings.DontExportExact;
            cb_DontExportFuzzy.Checked   = _settings.DontExportFuzzy;
            cb_DontExportNoMatch.Checked = _settings.DontExportNoMatch;
        }
Пример #2
0
        /// <summary>
        /// Updates the settings that user selected
        /// </summary>
        /// <param name="settings"></param>
        public void UpdateSettings(GeneratorSettings settings)
        {
            _settings = settings;
            _settings.DontExportContext = cb_DontExportContext.Checked;
            _settings.DontExportExact   = cb_DontExportExact.Checked;
            _settings.DontExportFuzzy   = cb_DontExportFuzzy.Checked;
            _settings.DontExportNoMatch = cb_DontExportNoMatch.Checked;

            _settings.ExcludedStatuses.Clear();
            foreach (SegmentStatus item in cbl_ExcludedStatuses.CheckedItems)
            {
                _settings.ExcludedStatuses.Add(item.Status);
            }

            if (rb_ExcludeStatus.Checked)
            {
                _settings.ExcludeExportType = GeneratorSettings.ExclusionType.Status;
            }
            if (rb_ExcludeCategory.Checked)
            {
                _settings.ExcludeExportType = GeneratorSettings.ExclusionType.Category;
            }
            if (excludeLockedBtn.Checked)
            {
                _settings.ExcludeExportType = GeneratorSettings.ExclusionType.Locked;
            }
        }
Пример #3
0
        /// <summary>
        /// Calls Automatic task method for data binding
        /// </summary>
        /// <param name="settings"></param>
        public void SetSettings(GeneratorSettings settings)
        {
            _settings = settings;

            SettingsBinder.DataBindSetting <string>(tb_Prefix, "Text", _settings,
                                                    nameof(_settings.FileNamePrefix));
            SettingsBinder.DataBindSetting <decimal>(n_ColumnWidth, "Value", _settings,
                                                     nameof(_settings.ColumnWidth));
            SettingsBinder.DataBindSetting <bool>(cb_ExtractComments, "Checked", _settings,
                                                  nameof(_settings.ExtractComments));
        }
Пример #4
0
        /// <summary>
        /// Calls Automatic task method for data binding
        /// </summary>
        /// <param name="settings"></param>
        public void SetSettings(GeneratorSettings settings)
        {
            _settings = settings;

            SettingsBinder.DataBindSetting <bool>(rb_ExcludeStatus, "Checked", _settings,
                                                  nameof(_settings.ExcludeStatus));
            SettingsBinder.DataBindSetting <bool>(rb_ExcludeCategory, "Checked", _settings,
                                                  nameof(_settings.ExclusionTypeCategory));
            SettingsBinder.DataBindSetting <bool>(cb_DontExportExact, "Checked", _settings,
                                                  nameof(_settings.DontExportExact));
            SettingsBinder.DataBindSetting <bool>(cb_DontExportContext, "Checked", _settings,
                                                  nameof(_settings.DontExportContext));
            SettingsBinder.DataBindSetting <bool>(cb_DontExportFuzzy, "Checked", _settings,
                                                  nameof(_settings.DontExportFuzzy));
            SettingsBinder.DataBindSetting <bool>(cb_DontExportNoMatch, "Checked", _settings,
                                                  nameof(_settings.DontExportNoMatch));
            UpdateUi(settings);
        }
        public void Initialize(string outputFile, GeneratorSettings settings)
        {
            //reset main settings
            ConversionSettings = settings;

            // Create a spreadsheet document by supplying the filepath.
            // By default, AutoSave = true, Editable = true, and Type = xlsx.
            ExcelDocument = SpreadsheetDocument.Create(outputFile, SpreadsheetDocumentType.Workbook);

            // Add a WorkbookPart to the document.
            ExcelWorkbookPart          = ExcelDocument.AddWorkbookPart();
            ExcelWorkbookPart.Workbook = new Workbook();
            ExcelWorkbookPart.Workbook.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");

            // Add a WorksheetPart to the WorkbookPart.
            ExcelWorkSheetPart           = ExcelWorkbookPart.AddNewPart <WorksheetPart>();
            ExcelWorkSheetPart.Worksheet = SetWorksheetData();

            // Add Sheets to the Workbook.
            Sheets sheets = ExcelDocument.WorkbookPart.Workbook.AppendChild <Sheets>(new Sheets());

            // Append a new worksheet and associate it with the workbook.
            Sheet sheet = new Sheet()
            {
                Id = ExcelDocument.WorkbookPart.GetIdOfPart(ExcelWorkSheetPart), SheetId = 1, Name = "Exported data"
            };

            sheets.Append(sheet);

            // Get the SharedStringTablePart.
            ExcelSharedStringsTable = ExcelDocument.WorkbookPart.AddNewPart <SharedStringTablePart>();

            //Set custom styles
            WorkbookStylesPart workbookStylesPart = ExcelDocument.WorkbookPart.AddNewPart <WorkbookStylesPart>();

            workbookStylesPart.Stylesheet = GenerateStylesheet();

            ExcelStyleSheet = ExcelDocument.WorkbookPart.WorkbookStylesPart.Stylesheet;

            CreateHeader();

            // Save the new worksheet.
            ExcelWorkSheetPart.Worksheet.Save();
        }
Пример #6
0
 public FileReader(DataExtractor dataExtr, GeneratorSettings settings, string filePath)
 {
     _dataExtractor    = dataExtr;
     _convertSettings  = settings;
     _originalFilePath = filePath;
 }
Пример #7
0
 public Worker(GeneratorSettings settings)
 {
     _settings = settings;
 }
Пример #8
0
 public void UpdateSettings(GeneratorSettings settings)
 {
     _settings = settings;
 }
 /// <summary>
 /// Initialize settings for the project
 /// </summary>
 protected override void OnInitializeTask()
 {
     _settings = GetSetting <GeneratorSettings>();
 }